how to choose a current selected row in ListView

Method 1:

for (int i = 0; i < lv.Items.Count; i++)
// is i the index of the row I selected?
if (lv.Items[i].Selected == true)
{
//I show here the second field text (SubItems[1].Text) from the selected row(Items[i])
Message.Show(lv.Items[i].SubItems[1].Text);
break;
}

method 2:

we use FocusedItem property of lisview.
for example:
tbSearch.Text = lv.FocusedItem.SubItems[0].Text;


------
name: nguyen minh hoang
net name: mathhoang
Y!M: vietnam_hoangminhnguyen@yahoo.com
mail: vietnam_hoangminhnguyen@yahoo.com
------

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...