Solved

capturing the index of selected row of  listview

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

760 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

23 Experts available now in Live!

Get 1:1 Help Now