Solved

capturing the index of selected row of  listview

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

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

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…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

770 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