private void btnAdd_Click(object sender, EventArgs e) { DeviceForm deviceForm = new DeviceForm(); deviceForm.ViewMode = DeviceForm.Mode.CREATE; deviceForm.InitForm(); DialogResult result = deviceForm.ShowDialog(); if (result == DialogResult.OK) { if (deviceForm.isSuccess) { loadListDevice(); } } }
private void dgvDivices_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1) { return; } DeviceForm deviceForm = new DeviceForm(); deviceForm.ViewMode = DeviceForm.Mode.EDIT; deviceForm.paramUpdate = (MDevice)dgvDevices.CurrentRow.DataBoundItem; deviceForm.InitForm(); DialogResult result = deviceForm.ShowDialog(); if (result == DialogResult.OK) { if (deviceForm.isSuccess) { loadListDevice(); } } }