Results 1 to 4 of 4

Thread: [2005] How to get Images from Resource

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,158

    [2005] How to get Images from Resource

    i have 18 images in the resource named as img1,img2,img3.....img18. And also i have an listbox with 18 items.

    so what i want is
    when the first item of the listbox is selected then img1 should be loaded in the picturebox and similarly the if 2nd item is selected then img2 must be loaded and so on for all the 18 images

    is there an any other way instead of using multiple if statements?

    Plz help

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] How to get Images from Resource

    Put all your Images into an array, then use the SelectedIndex of the ListBox to get the corresponding Image.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,158

    Re: [2005] How to get Images from Resource

    instead of using an array of images can an array of image reference can be used? If yes please let me know how

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] How to get Images from Resource

    Quote Originally Posted by aashish_9601
    instead of using an array of images can an array of image reference can be used? If yes please let me know how
    Image is a class so it's a reference type, therefore an array of Images already IS an array of Image references.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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