private void btnThem_Click(object sender, EventArgs e) { FormThem_CapNhatKH newForm = new FormThem_CapNhatKH(); this.Visible = false; newForm.Show(); newForm.Disposed += NewForm_Disposed; }
private void btnSua_Click(object sender, EventArgs e) { DataGridViewRow row = dataGVKhachHang.SelectedRows.Count >= 1 ? dataGVKhachHang.SelectedRows[0] : null; if (row != null) { string maKH = row.Cells["colMaKH"].Value.ToString(); string tenKH = row.Cells["colTenKH"].Value.ToString(); string email = row.Cells["colEmail"].Value.ToString(); string sdt = row.Cells["colSDT"].Value.ToString(); string diaChi = row.Cells["colDC"].Value.ToString(); string gioiTinh = row.Cells["colGioiTinh"].Value.ToString(); DateTime ngaySinh = (DateTime)row.Cells["colNgaySinh"].Value; FormThem_CapNhatKH newForm = new FormThem_CapNhatKH(maKH, tenKH, sdt, email, diaChi, gioiTinh, ngaySinh); this.Visible = false; newForm.Show(); newForm.Disposed += NewForm_Disposed; } else { MessageBox.Show("Bạn chưa chọn khách hàng để sửa"); ; } }