' DisplayImage Project ' When btnDisplay button is clicked, display EarthFromMoon.jpg image ' found in the source code folder. When btnReset button is clicked, ' clear the picture box. Public Class Form1 Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents btnDisplay As System.Windows.Forms.Button Friend WithEvents btnReset As System.Windows.Forms.Button Friend WithEvents picDisplay As System.Windows.Forms.PictureBox Private Sub InitializeComponent() Me.btnDisplay = New System.Windows.Forms.Button Me.btnReset = New System.Windows.Forms.Button Me.picDisplay = New System.Windows.Forms.PictureBox Me.SuspendLayout() ' 'btnDisplay ' Me.btnDisplay.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.btnDisplay.Location = New System.Drawing.Point(40, 208) Me.btnDisplay.Name = "btnDisplay" Me.btnDisplay.Size = New System.Drawing.Size(264, 40) Me.btnDisplay.TabIndex = 0 Me.btnDisplay.Text = "Display Image" ' 'btnReset ' Me.btnReset.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.btnReset.Location = New System.Drawing.Point(40, 256) Me.btnReset.Name = "btnReset" Me.btnReset.Size = New System.Drawing.Size(264, 40) Me.btnReset.TabIndex = 1 Me.btnReset.Text = "Reset" ' 'picDisplay ' Me.picDisplay.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me.picDisplay.Location = New System.Drawing.Point(40, 16) Me.picDisplay.Name = "picDisplay" Me.picDisplay.Size = New System.Drawing.Size(264, 184) Me.picDisplay.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage Me.picDisplay.TabIndex = 2 Me.picDisplay.TabStop = False ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(352, 310) Me.Controls.Add(Me.picDisplay) Me.Controls.Add(Me.btnReset) Me.Controls.Add(Me.btnDisplay) Me.Name = "Form1" Me.Text = "DisplayImage Project" Me.ResumeLayout(False) End Sub #End Region Private Sub btnDisplay_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnDisplay.Click picDisplay.Image = Image.FromFile("EarthFromMoon.jpg") End Sub Private Sub btnReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReset.Click picDisplay.Image = Nothing End Sub End Class