M
Martin
Hi,
I'm having a problem with a datagridview control when trying to read
the value of an unbound checkbox cell.
The code below works fine if I click on any text cell, bound or unbound,
and also if I click on a data bound checkbox cell.
But it fails with null reference exception if I try to read the value on an
unbound cell.
Can anybody show me where I'm going wrong?
TIA
Martin.
Private Sub InvoicesDataGridView_CellClick(ByVal sender As Object, _
ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) _
Handles InvoicesDataGridView.CellClick
' This line works, prints system.boolean
Debug.Print( _
Me.GridView.Rows(e.RowIndex).Cells(e.ColumnIndex).ValueType.ToString)
' This line fails, NullReferenceException
Debug.Print( _
Me.GridView.Rows(e.RowIndex).Cells(e.ColumnIndex).Value.ToString)
End Sub
I'm having a problem with a datagridview control when trying to read
the value of an unbound checkbox cell.
The code below works fine if I click on any text cell, bound or unbound,
and also if I click on a data bound checkbox cell.
But it fails with null reference exception if I try to read the value on an
unbound cell.
Can anybody show me where I'm going wrong?
TIA
Martin.
Private Sub InvoicesDataGridView_CellClick(ByVal sender As Object, _
ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) _
Handles InvoicesDataGridView.CellClick
' This line works, prints system.boolean
Debug.Print( _
Me.GridView.Rows(e.RowIndex).Cells(e.ColumnIndex).ValueType.ToString)
' This line fails, NullReferenceException
Debug.Print( _
Me.GridView.Rows(e.RowIndex).Cells(e.ColumnIndex).Value.ToString)
End Sub