Hey there,
I have a listview with 2 columns that puts the text taken from a textbox in the first column and the value of a radiobutton in the second one. Upon pressing the "add" button the text and the value appear in the listview, and the text is also added to a combobox.
I've also a contextmenustri p which is attached to the table, and upon pressing the "delete row" button in it, it deletes a whole row from the listview.
My problem is that even if I remove a given text from the listview, it stays in the combobox. How can I implement such a feature that when a given row is deleted from the listview, the same values disappear from the combobox?
I have a listview with 2 columns that puts the text taken from a textbox in the first column and the value of a radiobutton in the second one. Upon pressing the "add" button the text and the value appear in the listview, and the text is also added to a combobox.
Code:
ListViewItem lvi3 = new ListViewItem(textBox3.Text); //now adding the radiobutton value lvi3.SubItems.Add(textfromradiobutton); //refreshing the list listView3.Items.Add(lvi3); //adding the text from textbox to the combobox comboBox1.Items.Add(textBox3.Text);
Code:
private void usuńRekordToolStripMenuItem2_Click(object sender, EventArgs e)
{
if (listView3.SelectedItems.Count != 0)
{
foreach (ListViewItem lvi3 in listView3.SelectedItems)
lvi3.Remove();
}
}
Comment