My Name is Kay....

DIY , 먹방 , 개발 , 육아 , 여행 좋아합니다.
AdBlock 사용시 화면이 정상적으로 노출되지 않습니다.
포스팅 관련 문의 및 개발 문의는 Email : wkzkfmxksi@gmail.com

추가 포스팅이 이뤄지지 않는 블로그입니다. 문의는 wkzkfmxksi@gmail.com 으로 연락주세요.
kay
조회 수 9555 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

Null / Empty 값일 경우 체크하기


int i = dataGridView1.Rows.Count;
for (int j = 0; j < i; j++)
{
	string strCol2 = null;
	string strCol3 = null;
	if (dataGridView1.Rows[j].Cells[1].Value == null || dataGridView1.Rows[j].Cells[1].Value == DBNull.Value )
		strCol2 = "----";
	else
		strCol2 = dataGridView1.Rows[j].Cells[1].Value.ToString();

	if (dataGridView1.Rows[j].Cells[2].Value == null || dataGridView1.Rows[j].Cells[2].Value == DBNull.Value )
		strCol3 = "----";
	else
		strCol3 = dataGridView1.Rows[j].Cells[2].Value.ToString();
}
?