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
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
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