Peter Kiers
asked on
How to delete a listview row
Hi,
I have a listview on my form with 2 toolbar-buttons. One button is for adding a row
to the listview. And I would like the second button for deleting a row that the user
has selected.
Does anyone know the code for deleting a row in a listview that is selected by a user?
Greetings,
Peter
I have a listview on my form with 2 toolbar-buttons. One button is for adding a row
to the listview. And I would like the second button for deleting a row that the user
has selected.
Does anyone know the code for deleting a row in a listview that is selected by a user?
Greetings,
Peter
Code for adding a row to the listview:
private void tbNewNote_Click(object sender, EventArgs e)
{
frmNote.txtCaption.Text = "";
frmNote.rtbContent.Clear();
frmNote.lblCreation.Text = (DateTime.Now.ToString());
if (frmNote.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
ListViewItem myItem = new ListViewItem(frmNote.txtCaption.Text, 0);
myItem = lvNotes.Items.Add(myItem);
myItem.SubItems.Add(frmNote.rtbContent.Text);
myItem.SubItems.Add(frmNote.lblCreation.Text);
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hope that helps.