private void btnSua_Click(object sender, EventArgs e) { DataGridViewRow row = dataGVNhanVien.SelectedRows.Count >= 1 ? dataGVNhanVien.SelectedRows[0] : null; if (row != null) { string maNV = row.Cells["colMaNV"].Value.ToString(); string tenNV = row.Cells["colTenNV"].Value.ToString(); string sdt = row.Cells["colSDT"].Value.ToString(); string email = row.Cells["colEmail"].Value.ToString(); string diaChi = row.Cells["colDiaChi"].Value.ToString(); string gioiTinh = row.Cells["colGioiTinh"].Value.ToString(); DateTime ngaySinh = (DateTime)row.Cells["colNgaySinh"].Value; DateTime ngayVaoLam = (DateTime)row.Cells["colNgayVaoLam"].Value; string chucVu = row.Cells["colChucVu"].Value.ToString(); string tenTK = row.Cells["colTenTK"].Value.ToString(); FormThem_CapNhatNV newForm = new FormThem_CapNhatNV(maNV, tenNV, sdt, email, diaChi, gioiTinh, ngaySinh, ngayVaoLam, chucVu, tenTK); this.Visible = true; newForm.Show(); newForm.Disposed += NewForm_Disposed; } else { MessageBox.Show("Bạn chưa chọn nhân viên để sửa"); } }
private void btnThem_Click(object sender, EventArgs e) { FormThem_CapNhatNV newForm = new FormThem_CapNhatNV(); this.Visible = false; newForm.Show(); newForm.Disposed += NewForm_Disposed; }