Kiran Angara

Good afternoon.

Could you please teach me what is the best way to check whether the cell got any value or not (.cellvalue) irrespective with the data type.
I am confused to understand clearly, sometimes comparing with IsNull or VbNullString.

Thank you.

Cell values are Variants so in VB you could compare with the special value 'Empty' to know whether a cell value is absent. However, in iGrid ActiveX the default cell value depends on the column default cell, which is generally set to an empty string for text cells. See also the iGrid.ColDefaultCell().vValue property.

Can you tell us the situation in which you have troubles with detecting whether a cell value is not set?
Kiran Angara
Hello Igor,

Good afternoon.

As per your suggestion, I tried condition check with both cell value and cell text with 'Empty'.
Along with the above testing also copy the cell value to a variable of a variant data type but still, the result is same.
Even though the cell value contains zero (0) value but accepted as 'Empty' and with cell text is not accepted as 'Empty'.
Actually my intention is to store value in the database if it's a zero value and ignore if 'Empty'.

Refer to the attachment for your kind perusal.


Please advise.
In the first case you deal with a numeric value. The numeric 0 and Empty are two different values. Do you think you can compare them using "="? I think you need to check the type of the cell value first.

In the second case the situation is even worse. You have a STRING in the cell, though it looks like a number. See the double quotes in the tooltip? The solution is almost the same - check the type of the cell value first and convert it to a number or do something like that before you can compare it to 0 or Empty.
Kiran Angara
Hello Igor,

As per your suggestion, I initialize a vValue for each column as mentioned below.
Now I can compare each column cell value easily.

Thank you.


With .ColDefaultCell(CInt(g_vGridFields(iGrd, i, 4)))
.eType = igCellText
.eAlignH = g_vGridFields(iGrd, i, 10)
Select Case g_vGridFields(iGrd, i, 6)
Case vbDecimal
.sFmtString = "#,##0.00000000"
.vValue = CDbl(0)
Case vbCurrency
.sFmtString = "#,##0.0000"
.vValue = CCur(0)
Case vbDouble
.sFmtString = "#,##0.00"
.vValue = CDbl(0)
Case vbInteger, vbLong
.sFmtString = "#,##0"
.vValue = CLng(0)
Case vbDate
.sFmtString = "Short Date"
.vValue = Null
Case vbString
.vValue = Null
Case Else
.vValue = Null
End Select
End With