For i As Integer = 0 To DataGridView1.RowCount - 1
fundwith += DataGridView1.Rows(i).Cells("Withdrawal").Value
trans += DataGridView1.Rows(i).Cells("Trans").Value
meal += DataGridView1.Rows(i).Cells("Meal").Value
rep += DataGridView1.Rows(i).Cells("Rep").Value
meet += DataGridView1.Rows(i).Cells("Meet").Value
misc += DataGridView1.Rows(i).Cells("Misc").Value
oth += DataGridView1.Rows(i).Cells("Others").Value
inc += DataGridView1.Rows(i).Cells("Inc").Value
dec += DataGridView1.Rows(i).Cells("Dec").Value
Next
이 오류가 발생합니다. 'Double'유형에 'Operator'+ '가 정의되어 있지 않으며'DBNull 'DataGridview의 열이 표시되지 않는 경우 합계를 계산하십시오.
두 컬럼이 보이지 않으면 어떻게 Inc Inc와 Column Dec의 합계를 구합니까?
는 &'dec' 열이 실제로 데이터하지만 눈에 보이지 않는를 포함하거나이 가능 단지들에 DBNull이이 inc''합니까 열? –
감사합니다. 이제 나는 내 실수를 안다. 값이 null이므로 그 이유는 오류입니다. – elaine8s
DBNull을 검사하여'Double'의 디폴트 값 (0) 인'inc + = CheckDBNull (DataGridView1.Rows (i) .Cells ("Inc") .Value)'와 자동으로 변환 할 수 있다고 생각합니다. –