public void dtg_Hocky_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { frm_capnhat frm = new frm_capnhat(); var r = dtg_Hocky.Rows[e.RowIndex]; frm.txt_id.Text = r.Cells[0].Value.ToString(); frm.txt_hk.Text = r.Cells[1].Value.ToString(); frm.txt_hp.Text = r.Cells[2].Value.ToString(); frm.ckb_km.Text = r.Cells[3].Value.ToString(); }
private void btn_capnhat_Click(object sender, EventArgs e) { frm_capnhat frm = new frm_capnhat(); frm.txt_id.Text = dtg_Hocky.CurrentRow.Cells[0].Value.ToString(); frm.txt_hk.Text = dtg_Hocky.CurrentRow.Cells[1].Value.ToString(); frm.txt_hp.Text = dtg_Hocky.CurrentRow.Cells[2].Value.ToString(); if (dtg_Hocky.CurrentRow.Cells[3].Value.ToString() == "false") { frm.ckb_km.CheckState = CheckState.Unchecked; } else if (dtg_Hocky.CurrentRow.Cells[3].Value.ToString() == "true") { frm.ckb_km.CheckState = CheckState.Checked; } if (frm.ShowDialog() == DialogResult.OK) { frm.Close(); } var hk = hk_ctl.GetAllHK(); UpdateDtg(hk); }