?
Solved

capturing the index of selected row of  listview

Posted on 2010-11-18
3
Medium Priority
?
454 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1000 total points
ID: 34170802
oh yeah.. sorry. just use this
ListView1.SelectedIndices(0)

Open in new window

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

752 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