I have two form in my project, Form1 and Form2. In Form1 is a datagridview and a button, like shown in this pic:
If click button1 in Form1, it will show Form2. In Form2 there is a second button. I want to remove the last item in listview on Form1 if I click the button on form2.
Form1 code:
private void button1_Click(object sender, EventArgs e)
{
Form2 fm = new Form2(dataGridViewData);
fm.ShowDialog();
}
Form2 code :
private void button1_Click(object sender, EventArgs e)
{
for (int i = 0; i < dataGridViewData.SelectedRows - 1; i++)
{
dataGridViewData.Rows.Remove(dataGridViewData.SelectedRows[i]);
}
this.Close();
}