Solved

capturing the index of selected row of  listview

Posted on 2010-11-18
3
422 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

930 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now