• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 459
  • Last Modified:

capturing the index of selected row of listview

I need the code for capturing the slected row index of a listview for vb.net
I am using VS2003
0
vbstudent9
Asked:
vbstudent9
  • 2
1 Solution
 
hosneylkCommented:

private void ListView1_SelectedIndexChanged(object sender, EventArgs e)
{
     if (ListView1.SelectedIndices.Count <= 0)
     {
            return;
     }
     int intselectedindex = ListView1.SelectedIndices[0];
     if (intselectedindex >= 0)
    { 
       MessageBox.Show(ListView1.Items[intselectedindex].Text);
    }
}

Open in new window

0
 
vbstudent9Author Commented:
is it for vb.net
0
 
hosneylkCommented:
oh yeah.. sorry. just use this
ListView1.SelectedIndices(0)

Open in new window

0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now