I would like to update the data contained in a ListviewItem contained itself in a ListView.
The idea is when a row of the listview is selected, I click on a button and the data is updated .
I have this code :
ListView listView1 = new System.Windows.Forms.ListView();
ListViewItem lv1 = new ListViewItem("me");
lv1.SubItems.Add("my brother");
listView1.Items.Add(lv1);
Button myB = new System.Windows.Forms.Button();
private void myB_Click(object sender, EventArgs e)
{
listView1.SelectedItems[0] ....... ;
}
I know how to go any further to acces to modify the value of “my brother” to “my sister”.
Thanks in advance.
Check if something is selected then access the first ListViewItem in the SelectedItems
this is the reference on MSDN for ListViewSubItem class