vb .net

chou0623

Newcomer
Joined
Nov 22, 2003
Messages
1
Dear all,
I am stocked in step e. See below. Can anyone help me? Thanks a lot.
I need to code an application that allows the user to display an image that corresponds to the item selected in a list box. Step a. open the image solution. step b. set the list box's sorted property to true. step c. create a new form-level collection named mpictureboxcollection. step d. in the form's load event procedure, add the cloudpiceturebox, lightingpicturebox,rainpicturebox,snowpicturebox, and sunpicturebox controls to the mpictureboxcollection. after doing so, fill the elementlistbox with the following items: cloud, rain,snow,sun,and lighting, then select the first item in the list.(hint: when adding the picture boxes to the mpictureboxcollection, assign a key to each picture box. Relate each picture box's key to the index of its associated item in the list box.) step e. code the list box's selectedvaluechanged event procedure so that it displays, in the elementpicturebox control, the image that corresponds to the item selected in the list box.
Below is the code that I have done so far
Visual Basic:
Private Sub ImageForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'add CloudPictureBox control to mPictureBoxCollection
mPictureBoxCollection.Add(Me.CloudPictureBox)

'add RainPictureBox control to mPictureBoxCollection
mPictureBoxCollection.Add(Me.RainPictureBox)
'add SnowPictureBox control to mPictureBoxCollection
mPictureBoxCollection.Add(Me.SnowPictureBox)
'add SunPictureBox control to mPictureBoxCollection
mPictureBoxCollection.Add(Me.SunPictureBox)
'add LightningPictureBox control to mPictureBoxCollection
mPictureBoxCollection.Add(Me.LightningPictureBox)
' Fill the elementlistbox with cloud,rain,snow,sun, and lighting
Me.ElementListBox.Items.Add("Cloud")
Me.ElementListBox.Items.Add("Rain")
Me.ElementListBox.Items.Add("Snow")
Me.ElementListBox.Items.Add("Sun")
Me.ElementListBox.Items.Add("Lightning")

End Sub
Private Sub ElementListBox_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ElementListBox.SelectedValueChanged
 
Last edited by a moderator:
Back
Top