private void BtnNew_Click(object sender, EventArgs e) { using (FrmNewVehicle nv = new FrmNewVehicle()) { nv.ShowDialog(this); } }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { DataGridView dgv = sender as DataGridView; if (dgv == null) { return; } if (e.ColumnIndex == 5) { using (FrmNewVehicle nv = new FrmNewVehicle()) { nv.EditItem = (Vehicle)dgv.CurrentRow.DataBoundItem; nv.ShowDialog(this); } } else if (e.ColumnIndex == 6) { if (MessageBox.Show(this, "¿Esta seguro que desea eliminar el registro?", "Prueba.NET", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { _presenter.DeleteVehicle((Vehicle)dgv.CurrentRow.DataBoundItem); } } }