Webnode

VB - Listview

Hello, in this tutorial I'll teach you how to use the Listview component in Visual Basic 2008/2010.
ListView control allows you to display a list of items with item text and, optionally, an icon to identify the type of item.

Start by creating a new windows forms application.

Open the toolbox and add the listview component to your form:

It should look like this:

For this tutorial I'll teach you how to make something like this:

To do this, click on your listview component and set the view propertie to details:

Now right-click your listview component and choose 'Edit columns':

 

A window should open. Click the add button to add a column:

Change the text propertie to whatever you like:

You can add more columns if you like.

To add a items to your listview, close the columnheader window and right-click your listview and choose 'Edit items':

Click the add button to add a new item to your listview:

Change the text propertie to whatever you like:

To add a subitem, click the '...' button next to the subitems propertie:

Click the add button to add a new subitem:

 Change the text propertie to whatever you like and click OK.

If you would like to see this subitem, you will need to add another column:

If you would like to add items to your listview component using code, you can do this by using the following code:

I hope you found this tutorial usefull !

Download the source codes:
ListviewComp.rar (62,9 kB)


Topic: VB - Listview

No comments found.