[2005] Fill a combobox with the names of a imagelist imagesnames.
Hi All,
I didn't found something about that subject.
Like the question says.
I want to fill a combobox with the Imagesnames from a imagelist.
How can I do that?
This is already a part of my app.
When I fill my combobox manually then I call the image like this:
Code:
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
PictureBox1.Image = (ImageList1.Images(ComboBox1.SelectedItem & ".jpg"))
End Sub
That's working very good, but how should I do the other part.
Thanks,
sparrow1
Re: [2005] Fill a combobox with the names of a imagelist imagesnames.
Part of the problem is that the file is loaded as a resource when it is added to your imagelist.
If you want the filename of the file itself, don't use an image list. Instead, just store all of the file in a special folder in your app. Then, use the File.IO to get the files:
vb Code:
Dim strFiles() As String = System.IO.Directory.GetFiles("path")
Loop through for all the file names and add them to the combobox