1) on button press: remove selected rows in both dataGridView1 and dataGridView3
2) if dataGridView3 has #0 rows: show 'save dialog
private void Bt_Remove_Row_Click(object sender, EventArgs e)
{
foreach (DataGridViewRow row in dataGridView3.SelectedRows)
{
dataGridView3.Rows.RemoveAt(row.Index);
}
foreach (DataGridViewRow row in dataGridView1.SelectedRows)
{
dataGridView1.Rows.RemoveAt(row.Index);
}
if (dataGridView3.Rows.Count == 0)
{
Bt_Remove_Row.Enabled = false;
Bt_Print.Enabled = false;
Bt_Clear_List.Enabled = false;
Bt_Borrowd.Enabled = false;
Bt_Save_Borrowd.Enabled = false;
DialogResult dialogresult = MessageBox.Show("WEET U HET ZEKER", "DE LIJST UITGELEEND GEREEDSCHAP WORD LEEG GEMAAKT", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (dialogresult == DialogResult.Yes)
{
File.WriteAllText(UitleenBestand, String.Empty);
MessageBox.Show("BESTAND UITGELEEND GEREEDSCHAP IS AAN GEMAAKT", "BESTAND!!!", MessageBoxButtons.OK, MessageBoxIcon.Information);
Lb_Uitleen.Text = ("");
}
if (dialogresult == DialogResult.No)
Bt_Borrowd.Enabled = true;
}
else
{
Bt_Remove_Row.Enabled = true;
Bt_Clear_List.Enabled = true;
Bt_Print.Enabled = true;
}
}