내 응용 프로그램에 Winforms DataGridView가 있습니다.Windows Forms DataGridview에서 체크 상자 클릭 이벤트 캡처
두 개의 확인란과 데이터베이스의 다른 5 개 열이 있습니다. 이 두 개의 확인란 열은 DataGridViewCheckBoxColumn에 추가됩니다.
사용자가 두 번째 확인란을 클릭하면 해당 행에 대해 첫 번째 확인란을 선택하지 않은 경우 사용자에게 메시지를 표시해야합니다.
어떻게해야합니까? 이 시도했지만 셀 값이 null로 오는 것입니다. 내가 뭘 잘못 했니?
private void dgTest_CellClick(System.Object sender, DataGridViewCellEventArgs e)
{
DataGridViewCheckBoxCell officialCbCell = row.Cells[1] as DataGridViewCheckBoxCell;
DataGridViewCheckBoxCell includeCbCell = row.Cells[0] as DataGridViewCheckBoxCell;
if (officialCbCell != null)
{
if (officialCbCell.Value != null && (bool)officialCbCell.Value == true)
{
if (includeCbCell != null && (bool)includeCbCell.Value == false)
{
MessageBox.Show("INVALID");
}
}
}
}
감사합니다.
이 부분에 대한 의견을 보내주십시오. 고마워요. – Jimmy