J Trahair
Well-known member
DGV cell containing a number doesn't like If grd1.Item(2, numRowNo).Value = "" Then
Hi.
In many places I need to test whether a cell contains a value, or is blank.
However, sometimes the value is a number, such a 12.45 or 5038051368669 (a bar code). At these moments the cell decides to throw an exception because it treats the number as a number not a string.
I thought, if I wanted to treat a DGV cell value as a number I should put Val() around the cell value. I also thought that a DGV cell value was a string regardless of what it actually is.
If the cell contains a number, how can I test for a blank? Normally the cell is blank, not zero, or it contains a string of numbers.
Thank you.
Hi.
In many places I need to test whether a cell contains a value, or is blank.
VB.NET:
If grd1.Item(2, numRowNo).Value = "" Then
However, sometimes the value is a number, such a 12.45 or 5038051368669 (a bar code). At these moments the cell decides to throw an exception because it treats the number as a number not a string.
I thought, if I wanted to treat a DGV cell value as a number I should put Val() around the cell value. I also thought that a DGV cell value was a string regardless of what it actually is.
If the cell contains a number, how can I test for a blank? Normally the cell is blank, not zero, or it contains a string of numbers.
Thank you.