Hello Everyone!.. In my form there is a ListView, three txtBoxes and an 'Update' button. What i try to do is to update the selectedItem in the listView...User selects the item to be updated and writes the new item in 3 txtBoxes and pushes the Update button..
i tried some codes but did not work..
Thank You...
yusufPosted Dec 11, 2007, 3:41 AM
AlanPosted Dec 10, 2007, 5:46 PM
If the TextBoxes contain some new sub-items for the selected item, then try putting code like the following in the Update button click eventhandler:
if (listView1.SelectedItems.Count > 0)
{
ListViewItem item = listView1.SelectedItems[0];
item.SubItems[0].Text = textBox1.Text;
item.SubItems[1].Text = textBox2.Text;
item.SubItems[2].Text = textBox2.Text;
}
This assumes that there's only one item selected or you only want to update the first item selected.