I have a datagrid and in mouse-click event of the dataGrid I have the code bellow for sending the value of current cell to a textbox, But the problem is when the cell of the datagrid which I am selecting is filled with null. Note that I have designed two columns in my db as "ID" and "Desc" which the "ID" does not allow NULL.
In this case, How can I make an IF clause for checking if the cell is NULL or not, because I have lost all my tries to do this matter. There Is the DBNull keyword and I can`t handle that even by IsNot or IsNot Nothing or Not or else
This is my code:
and this the error message:
In this case, How can I make an IF clause for checking if the cell is NULL or not, because I have lost all my tries to do this matter. There Is the DBNull keyword and I can`t handle that even by IsNot or IsNot Nothing or Not or else
This is my code:
VB.NET:
Me.txtID.Text = Trim(CStr(Me.myGrid.CurrentRow.Cells(0).Value))
Conversion from type 'DBNull' to type 'String' is not valid.
Last edited by a moderator: