Simple ListView Question - Getting Specific Column Data

Hey Everyone,

Ok, I think this is a simple question.  I have a listbox that gets information from a very basic SQL query (select * from x where y = 'z', something like that).  This query is going to return anywhere from 0 to probably 50 rows.  What I eventually want to do is click on a specific row and bring up a new form (which I've been able to do using the ListView1_SelectedIndexChanged) and pass data.

For now, all I want to do is have a MSGBOX come up when I click on the specific row and display information from a specific column.  So, if I have a results set in a listview that looks like:

Name            Date             Grade
Chris            10/1/07         A
Bill                10/2/07         C

If I click on the row with "Chris", a message box comes up and just shows "A".  

Make sense?

Chris, Baltimore
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

Wayne Taylor (webtubbs)Connect With a Mentor AstronautCommented:
Use this....

    If ListView1.SelectedItems.Count = 0 Then Exit Sub

Wayne Taylor (webtubbs)AstronautCommented:
Hi clebo99,,

Use the SubItems....



clebo99Author Commented:
Ok, that seemed to work........however if I go back to the same page and click on another row, I get an error stating:

InvalidArgument=Value of '0' is not valid for 'index'.
Parameter name: index

Do I need to "Reset" this somehow?
All Courses

From novice to tech pro — start learning today.