I have around 20 pictures in picturebox and i want to loop through all images and add it's name to a combobox then i use the combobox to change the picture in the picturebox. I Dont know how to loop through picturebox images.
To populate a ComboBox with images from resources :
For Each dicEntry As DictionaryEntry In resourceSet.OfType(Of Object)()
If TypeOf (dicEntry.Value) Is Drawing.Image Then
ComboBox1.Items.Add(dicEntry.Key.ToString())
End If
Next
To select the image and set it to a PictureBox :
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
Dim comboBox As ComboBox = CType(sender, ComboBox)
Dim sSelectedItem = CType(comboBox.SelectedItem, String)
Dim img As Image = CType(My.Resources.ResourceManager.GetObject(sSelectedItem), Image)
PictureBox1.BackgroundImage = img
End Sub