Solved

capturing the index of selected row of  listview

Posted on 2010-11-18
3
444 Views
Last Modified: 2012-05-10
I need the code for capturing the slected row index of a listview for vb.net
I am using VS2003
0
Comment
Question by:vbstudent9
  • 2
3 Comments
 
LVL 10

Expert Comment

by:hosneylk
ID: 34170769

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
 

Author Comment

by:vbstudent9
ID: 34170789
is it for vb.net
0
 
LVL 10

Accepted Solution

by:
hosneylk earned 250 total points
ID: 34170802
oh yeah.. sorry. just use this
ListView1.SelectedIndices(0)

Open in new window

0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
System.net.Sockets Error 5 39
VB.net Open video relating to control 2 30
VB.net Code to make a TaskPane float in Excel Add-in 2 25
"lblTime is not declared" 3 30
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question