Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Kiran Angara  
#1 Posted : Wednesday, November 20, 2019 7:16:47 AM(UTC)
Kiran Angara

Rank: Member

Groups: Registered
Joined: 6/10/2017(UTC)
Posts: 29

Thanks: 2 times
Hello,

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.

Igor/10Tec  
#2 Posted : Wednesday, November 20, 2019 3:26:47 PM(UTC)
Igor/10Tec

Rank: Administration

Groups: Administrators, Forum Moderator
Joined: 1/17/2011(UTC)
Posts: 1,111

Thanks: 15 times
Was thanked: 141 time(s) in 141 post(s)
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  
#3 Posted : Thursday, November 21, 2019 6:34:34 AM(UTC)
Kiran Angara

Rank: Member

Groups: Registered
Joined: 6/10/2017(UTC)
Posts: 29

Thanks: 2 times
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.

2019-11-21_12-49-31.jpg

Please advise.

Edited by user Monday, November 25, 2019 9:48:19 AM(UTC)  | Reason: Not specified

Igor/10Tec  
#4 Posted : Thursday, November 21, 2019 1:42:28 PM(UTC)
Igor/10Tec

Rank: Administration

Groups: Administrators, Forum Moderator
Joined: 1/17/2011(UTC)
Posts: 1,111

Thanks: 15 times
Was thanked: 141 time(s) in 141 post(s)
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  
#5 Posted : Friday, November 22, 2019 7:47:03 AM(UTC)
Kiran Angara

Rank: Member

Groups: Registered
Joined: 6/10/2017(UTC)
Posts: 29

Thanks: 2 times
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.

Quote:
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
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.