Results 1 to 2 of 2

Thread: [2005] Fill a combobox with the names of a imagelist imagesnames.

  1. #1

    Thread Starter
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    [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
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  2. #2
    Fanatic Member
    Join Date
    Aug 2006
    Location
    Chicago, IL
    Posts
    514

    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:
    1. Dim strFiles() As String = System.IO.Directory.GetFiles("path")

    Loop through for all the file names and add them to the combobox
    Warren Ayen
    Senior C# Developer
    DLS Software Studios (http://www.dlssoftwarestudios.com/)

    I use Microsoft Visual Studio 2005, 2008, working with Visual Basic and Visual C#
    Hey! If you like my post, or I solve your issue, please Rate Me!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width