vb.net

got a combo box with 3 varibles defined, underneath i have a picture box, i want when i click one of the varibles in the combo box, the picture to change (pictures stored locally in directory C:\Documents and Settings\Administrator\My Documents\My Pictures

Will be using select case for the main part. Cant for the love of me get it to work with my tired brain plz help :<
Comments
5
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged

yourpictureboxsource = Image.FromFile(myfiles(ComboBox1.SelectedIndex))

End Sub

Or work with case/if/...
Make sure you use exactly the same names that you have used for Resource names
nice stealing my code :-(
Parent
Quote
PrivateSub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged

'if the selected text is "Orange" (change to the text you want)
If ComboBox1.SelectedItem = "Orange" Then

'specify the location of your picture
PictureBox1.Image = Image.FromFile("C:\Orange.jpg")
ElseIf ComboBox1.SelectedItem = "Apple" Then
PictureBox1.Image = Image.FromFile("C:\Apple.jpg")
ElseIf ComboBox1.SelectedItem = "Banana" Then
PictureBox1.Image = Image.FromFile("C:\banana2.jpg")
Else
PictureBox1.Image = Nothing 'nothing display in the picture box

EndIf
'add the items that has already selected into ListBox
ListBox1.Items.Add(ComboBox1.SelectedItem)
EndSub



This was yours!
All credits goes to Foonr!!!
Parent
on error resume
Back to top