public void EditData() { try { if (dataGridMaster.RowCount > 0) { int index = dataGridMaster.SelectedCells[0].RowIndex; string code = (string)dataGridMaster["Code", index].Value; var queryData = MasterProcessor.FindDataByCode(code, MasterProcessor.loadCsvFileEmployee(MasterProcessor.pathEmployee)); using (fmInputMaster f = new fmInputMaster()) { f.txtCode.Enabled = false; f.txtCode.Text = queryData.Code; f.txtName.Text = queryData.EmployeeName; f.txtAge.Text = queryData.Age; f.lblFlag.Text = "edit"; f.ShowDialog(); } } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
private void BtnAdd_Click(object sender, EventArgs e) { fmInputMaster f = new fmInputMaster(); f.lblFlag.Text = "new"; f.ShowDialog(); }