SorryDog777
Programmer
There is probably a simple answer for this question, but I have just run out of steam looking for the solution!
I have a unbound DataGridView on a form that a user populates. Some cells in the grid can contain null values.
I'm attempting to read the values from the cells to put into a custom database table with the below example:
Dim strCellString as String
strCellString = DataGridView1.Rows(1).Cells(1).Value.ToString
If the current is null the get the exception error. I also tried this statement
strCellString = IIf(DataGridView1.Rows(1).Cells(0).Value.ToString, DataGridView1.Rows(1).Cells(0).Value.ToString, "")
Also gives an exception.
Any suggestions to test for null without using the On Error, Resume Next statement?
Thanks.
I have a unbound DataGridView on a form that a user populates. Some cells in the grid can contain null values.
I'm attempting to read the values from the cells to put into a custom database table with the below example:
Dim strCellString as String
strCellString = DataGridView1.Rows(1).Cells(1).Value.ToString
If the current is null the get the exception error. I also tried this statement
strCellString = IIf(DataGridView1.Rows(1).Cells(0).Value.ToString, DataGridView1.Rows(1).Cells(0).Value.ToString, "")
Also gives an exception.
Any suggestions to test for null without using the On Error, Resume Next statement?
Thanks.