Ok, consider the example code given under the ListView class in the MSDN
library
(
http://msdn.microsoft.com/library/de...lasstopic.asp).
The code generates a ListView with 4 colums and 3 rows (in additon to the
column heading) . At the end of the code example a bitmap image is added to
the cell elements in the first colums by using the .Images.Add() method (ref
cited code at the bottom of my reply).
My question is: How can the bitmap images be added to the ListView elements
other than in the first column, that is, where the example code displays the
integers 2,3,5,6,8 and 9?
==================================
' Create two ImageList objects.
Dim imageListSmall As New ImageList()
Dim imageListLarge As New ImageList()
' Initialize the ImageList objects with bitmaps.
imageListSmall.Images.Add(Bitmap.FromFile("C:\MySm allImage1.bmp"))
imageListSmall.Images.Add(Bitmap.FromFile("C:\MySm allImage2.bmp"))
imageListLarge.Images.Add(Bitmap.FromFile("C:\MyLa rgeImage1.bmp"))
imageListLarge.Images.Add(Bitmap.FromFile("C:\MyLa rgeImage2.bmp"))
'Assign the ImageList objects to the ListView.
listView1.LargeImageList = imageListLarge
listView1.SmallImageList = imageListSmall
' Add the ListView to the control collection.
Me.Controls.Add(listView1)
End Sub 'CreateMyListView
======================================
"Mark R. Dawson" wrote:
Hi GT,
not sure I am quite following you when you say "first column", since a
ListView is a one dimensional structure. What are you trying to do? If you
want a 2D structure you probably want to have a list of listviews which you
can access.
Mark Dawson
http://www.markdawson.org
"GT" wrote:
Could someone please explain how to add images to a ListView other than in
the first column?