I used to fill a listview with dataset that is set to details view. Now, I need to fill the listview with images and by that I believed that I'd set the view to large icons. How to do this?

this is how I feel the listview

foreach (DataRow dr in ds.Tables["tblEventType"].Rows)
            {
                ListViewItem lvi = new ListViewItem(dr["eventName"].ToString());
                lvi.SubItems.Add(dr["startDateTime"].ToString());
                lvi.SubItems.Add(dr["endDateTime"].ToString());
                lvi.SubItems.Add(dr["location"].ToString());
                lvi.SubItems.Add(dr["contactPerson"].ToString());

                eventlv.Items.Add(lvi);
            }

For having images in the listView (on in some other control), best way is to use an ImageList. You put images inside, and from there show images in listView. For example, how to get images form a disc, send then to imageList and then to listView:

//for better accurecy you can you an OpenFileDialog class, in which you can set a filter to show only images (png, img, bmp...)
            DirectoryInfo dir = new DirectoryInfo(@"C:\MyPictures");
            foreach (FileInfo file in dir.GetFiles())
            {
                try
                {
                    this.imageList1.Images.Add(Image.FromFile(file.FullName));
                }
                catch
                {
                    MessageBox.Show("This is not an image file");
                }
            }
            this.listView1.View = View.LargeIcon;
            this.imageList1.ImageSize = new Size(32, 32);
            this.listView1.LargeImageList = this.imageList1;
            //or
            //this.listView1.View = View.SmallIcon;
            //this.listView1.SmallImageList = this.imageList1;
 
            for (int j = 0; j < this.imageList1.Images.Count; j++)
            {
                ListViewItem item = new ListViewItem();
                item.ImageIndex = j;
                this.listView1.Items.Add(item);
            }

Hope it give you an idea,
Mitja

commented: thanks +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.