In my project, I have a list box. When I click an item on the listbox, I want the PNG image from a file (stored in 1Global Varible, GV.dir1) into the Picture Box named picBox… this is what I have…
picBox.Image = Image.FromFile(GV.dir +
lstFull.SelectedIndex.ToString() + ".png");
GV.dir is equal to -> @"C:\Files"
You’re missing a
\after"C:Files", and are your png’s really named 0,1,2,3…etc. Using the.SelectedIndexproperty will just return the index number (as a string with the.ToString). I think you may want to useSelectedItem.ToStringinstead.