Mình có cái DataGridView CellClick Event, khi click vào nó sẽ chọn lưu thông tin của sinh viên vào biến SelectedStudentId.
Nhưng khi mình chạy thì khi chọn có khi lưu đc khi không. Đã thư cho mbox show để kiểm tra trực tiếp khi click thì thấy nó lúc click thì show đc thông tin id và mssv của ô đó, khi thì không. Ai giúp mình với
Code hàm cell click Event
private void dataGWMain_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
DataGridViewRow row = new DataGridViewRow();
row = dataGWMain.Rows[e.RowIndex];
Main.SelectedStudentId = row.Cells[2].Value.ToString();
MessageBox.Show(row.Cells[2].Value.ToString());
MessageBox.Show(row.Cells[0].Value.ToString());
}