Database Reference
In-Depth Information
Listing 17-3. Initializing Image Display in the DisplayImages Constructor
public DisplayImages()
{
InitializeComponent();
if (images.GetRow())
{
this.txtImageName.Text = images.GetFilename();
this.ptbImage.Image = (Image)images.GetImage();
}
else
{
this.txtImageName.Text = "DONE";
this.ptbImage.Image = null;
}
}
10. Insert the code in Listing 18-3 into the btnShowImage button's Click event
handler. You can access the btnShowImage_Click event handler by navigating
to the Design view of the DisplayImages form and double-clicking the
btnShowImage Button control.
Listing17-4. btnShowImage_Click Event in DisplayImages.cs
private void btnShowImage_Click(object sender, EventArgs e)
{
if (images.GetRow())
{
this.txtImageName.Text = images.GetFilename();
this.ptbImage.Image = (Image)images.GetImage();
}
else
{
this.txtImageName.Text = "DONE";
this.ptbImage.Image = null;
}
}
11. To set the TypedAccessor form as the start-up form, modify the Program.cs
statement.
Application.Run(new LoadImages());
to appear as
Application.Run(new DisplayImages());
 
Search WWH ::




Custom Search