I have this problem. I want to add image to listView. Exactly I want use openFileDialog for choose image on disc, load file to aplication and show them in listView.
Now I do it like this:
openFileDialog1.Filter = "png (*.png)|*.png";
openFileDialog1.Multiselect = true;
if ( openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string[] files = openFileDialog1.FileNames;
foreach ( var pngFile in files ) {
try {
Bitmap image = new Bitmap( pngFile );
imageList1.Images.Add( image );
} catch {
}
}
listView1.LargeImageList = imageList1;
listView1.Refresh();
}
But it doesn't work. What do I make wrong?
edit
I get blank listView. Nothing error.