Basically, I just want to ask how to check a datatable value if it is null or not? I am looping through each cells on the table, and check if the value of a cell is null.
I tried this
If Not dt.Rows(i)(j).value Is Nothing Then
MsgBox("cell empty")
End If
and
If Not dt.Rows(i)(j).value = "" Then
MsgBox("cell empty")
End If
but it is not working.
As of now, my datatable looks like this
"e" means empty
"ne" means not empty
"x" dont care
Col1 Col2 Col3 ...
ne x x ...
x e x ...
x x x ...
examples from the table above..
dt(0)(0) = ne
dt(1)(1) = e
dt(0)(1) = either "e" or "ne"
PS, all the data in the datatable are all strings..
how can I get the value if dt(1)(1) is empty? C# codes would be okay too..thanks
EDIT:
somehow, I've managed to solve my question by doing this, it met my requirement in my program so.. yea.
If dt.Rows(i)(j).Value.ToString = "" Then
MsgBox("empty")
End If
thanks. Please close the thread.