Step 1: Drag a listview control on to the form.
Step 2 : Go to the code page and write the following where you need to write acc. to your conditions.
listview1.view = view.detail; // indicating in which way you want to show the data in liastview
listview1.dock = dockstyle.fill; //styling listview control to be filled acc. to form.
// Adding columns to the listview
// listview1.column.add("column name",width of column,horizontalalignment.left);
listview1.column.add("",80,horizontalalignment.left);
listview1.column.add("Name",80,horizontalalignment.left);
listview1.column.add("Age",50,horizontalalignment.left);
// Creating imagelist to store images which are to shown in listview.
Int index = 0; // requires for indexing of the images in imagelist
Imagelist imglst = new imagelist();
Imagelist.Imagesize = new Size(90,60);//Set imagesize of the image to be displayed in listview
imglst.images.add(image address);
index= index+1; // index to be incremented if you want to add more images in your imagelist
// using imagelist witrh imagelist
listview1.smallimagelist = imglst; // assigning imagelist to listview
// ctreating listviewitem
listviewitem itm = new listviewitem();
itm.imageindex = index;
itm.subitem.add("aman"); // this will add aman to the column1 which we declared above.
itm.subitem.add("24"); // this will add 24 to column2
// adding itm to listview
listview1.items.add(itm);
OUTPUT:
--> Step 2 : Go to the code page and write the following where you need to write acc. to your conditions.
listview1.view = view.detail; // indicating in which way you want to show the data in liastview
listview1.dock = dockstyle.fill; //styling listview control to be filled acc. to form.
// Adding columns to the listview
// listview1.column.add("column name",width of column,horizontalalignment.left);
listview1.column.add("",80,horizontalalignment.left);
listview1.column.add("Name",80,horizontalalignment.left);
listview1.column.add("Age",50,horizontalalignment.left);
// Creating imagelist to store images which are to shown in listview.
Int index = 0; // requires for indexing of the images in imagelist
Imagelist imglst = new imagelist();
Imagelist.Imagesize = new Size(90,60);//Set imagesize of the image to be displayed in listview
imglst.images.add(image address);
index= index+1; // index to be incremented if you want to add more images in your imagelist
// using imagelist witrh imagelist
listview1.smallimagelist = imglst; // assigning imagelist to listview
// ctreating listviewitem
listviewitem itm = new listviewitem();
itm.imageindex = index;
itm.subitem.add("aman"); // this will add aman to the column1 which we declared above.
itm.subitem.add("24"); // this will add 24 to column2
// adding itm to listview
listview1.items.add(itm);
OUTPUT:
Name
|
Age
| |
Image
|
Aman
|
