how to retrieve data from listview to textbox?  
Author Message
digdug





PostPosted: Visual C# Express Edition, how to retrieve data from listview to textbox? Top

listview1 in Fullrowselect

Id Number | Name

1 | a

2 | b

3 | c

help! how can i retrieve the data from listview and display it in two textbox(txtboxID,txtboxName)




Visual Studio Express Editions10  
 
 
ahmedilyas





PostPosted: Visual C# Express Edition, how to retrieve data from listview to textbox? Top

well which data do you want to retrieve you usually go through the items property of the listview to get to the data you like.

 
 
nobugz





PostPosted: Visual C# Express Edition, how to retrieve data from listview to textbox? Top

Try something like this:

private void listView1_SelectedIndexChanged(object sender, EventArgs e) {
if (listView1.SelectedItems.Count > 0) {
ListViewItem itm = listView1.SelectedItems[0];
textBox1.Text = itm.SubItems[0].Text;
textBox2.Text = itm.SubItems[1].Text;
}
}