|
-
Mar 25th, 2008, 07:51 PM
#1
Thread Starter
Member
How to load corrosponding picture into picturebox??
Hi,
I have a datagridview filled with movie titles.
Below the datagridview i have a picturebox.
I have a folder filled with cover images in c:\covers
What i try to do is this:
When i click a name in the datagridview the corrosponding picture is automaticaly loaded in the picturebox.
does anybody know how that works?
Warad
-
Mar 25th, 2008, 07:56 PM
#2
Re: How to load corrosponding picture into picturebox??
do you have the filename displayed in your datagridview?
you could use an 2d array to associate a friendly name (as displayed in your datagridview) with the filename
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Mar 25th, 2008, 08:01 PM
#3
Frenzied Member
Re: How to load corrosponding picture into picturebox??
Well, I am not familiar with a datagrid view,
But all you do is do this:
Dim sMovieTitles() As String = {"Spider Man 3", "Fantastic Four"}
Dim sMoviePaths() As String = {"C:\Covers\Spiderman3.jpg", "C:\Covers\FantasticFour.jpg"}
Then you fill the datagrid with sMovieTitles, so that when you click an item
you will be able to retrieve the clicked item's image by Image.FromFile(sMoviePaths(IndexOfSelectedItem))
That's how I would do it in a combo box, IndexOfSelectedItem would be a variable you would set to the index of the current item selected in the data grid..
I am not familiar with them so I can not be more accurate, but that might help somewhat.
Cheers
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|