private void metroGrid1_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 0) { int Id = (int)metroGrid1.Rows[e.RowIndex].Cells["Id"].Value; UpdateTaraz updateTaraz = new UpdateTaraz(Id); updateTaraz.Show(); } else if (e.ColumnIndex == 1) { int Id = (int)metroGrid1.Rows[e.RowIndex].Cells["Id"].Value; var result = MetroFramework.MetroMessageBox.Show(this, "آیا مطمئن هستید این آیتم حذف شود؟", "اخطار", MessageBoxButtons.YesNo, MessageBoxIcon.Error); if (result == DialogResult.Yes) { _repository.Delete(Id); ViewTarazForm viewTarazForm = (ViewTarazForm)Application.OpenForms["ViewTarazForm"]; viewTarazForm.LoadGrid(); } else { ViewTarazForm viewTarazForm = (ViewTarazForm)Application.OpenForms["ViewTarazForm"]; viewTarazForm.LoadGrid(); } } }
private void UpdateTaraz_FormClosed(object sender, FormClosedEventArgs e) { ViewTarazForm viewTarazForm = (ViewTarazForm)Application.OpenForms["ViewTarazForm"]; viewTarazForm.LoadGrid(); }