0

Hi friends,
I have a list view which contains an id and a name.... upon selecting one row i should be able to view the details of that particular row.. i.e name, age, salary etc...Im using Visual studio .net 2003 and sql server 2005..

2
Contributors
3
Replies
5
Views
9 Years
Discussion Span
Last Post by emurf
0

In the selected index change or one of the click events of the list you should put.

dim strLine as strin 
strLine = List1.SelectedItem.Text

That will get you the line, from there you will need to do string splits & string manipulation on your data.

0

String splits allow you to easily retrieve values in a string. Lets say that the line that was read from the listview has been formated by putting a tab between the values. You would get the data like this;

'declare an array to hold the vals
dim listVals as String() = Nothing

'get the line from the list
strLine = List1.SelectedItem.Text

'get the vals from the string
listVals = strLine.Split(vbTab)

If the line wasn't formatted with tabs as it was added to the listview then you may have to use left, mid and right string functions.

Microsoft.VisualBasic.Right(string, length)
Microsoft.VisualBasic.Left(string, length)
Microsoft.VisualBasic.Mid(string, start pos, length)
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.