CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2010
    Posts
    4

    [RESOLVED] Load an Image in a PictureBox from a ListBox

    Hi!
    I want to make a program similar to this one: http://modthesims.info/download.php?t=275562
    I already have the ListBox ready. But how do I load the images?
    The image name works like this:
    -File1.package
    -File1A.jpg
    -File1B.jpg
    So the .package is removed and A.jpg or B.jpg is added.
    This doesn't make much sense unless you see the program at the above link
    ANY HELP is greatly appreciated!

  2. #2
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Load an Image in a PictureBox from a ListBox

    You can use the mid() function or the substring function to modify the filename
    Code:
    JpgName=Mid(Filename,1,len(FileName)-7) & "jpg"
    As for loading the image once you have the filename [assuming you are using a picturebox] you can simply set the image property = image.fromfile(jpgname)
    Always use [code][/code] tags when posting code.

  3. #3
    Join Date
    Jun 2010
    Posts
    4

    Smile Re: Load an Image in a PictureBox from a ListBox

    Thank you SO MUCH. I really appreciate it!

  4. #4
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: Load an Image in a PictureBox from a ListBox

    If you feel your thread has been answered to your satisfaction NickM406, then please mark your thread Resolved, as explained here :

    http://www.codeguru.com/forum/showthread.php?t=403073

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

Featured