Author: Lawrence Albert Pardo-Ilao - Naga City, Philippines

Unlock For Us

[C#] How to Get the Selected Index and Selected Item Text in List View Control

List View class makes the life easier. It represents a Windows list view control, which displays a collection of items that can be displayed using one of four different views.

I know this is not related to Windows Tips and Tricks. But since this blog is dedicated for helping users…. I decided to write the guide.


WinGuggle 2.1 System Summary tab is using a list view control written in





WinTinker Password Generator Web Applications Tab also uses a list view control

There is no SelectedIndex property in List View that’s why its very difficult to get the selected item text using its index.

Thankfully I found a workaround to get the selected index.

if (ListView1.SelectedItems[0].ToString().IndexOf("Audio") > 0)
    intindex = 1;  //set the index manually


Using the SelectedIndexChanged Event

private void ListViewWeb_SelectedIndexChanged(object sender, EventArgs e)
     if (ListViewWeb.SelectedIndices.Count <= 0)
     int intselectedindex = ListViewWeb.SelectedIndices[0];
     if (intselectedindex >= 0)


Hope this helps!



© UnlockForUs 2007-2021| Blogger| | License Agreement