Bug? If statement not working

atiaust

Active Member
Licensed User
Longtime User
Hi All,

I have a problem with a very simple If/Then statement which I can't explain and can only think it may be a bug.
I know the value of row(4) is 1

Log("row 4 = "&Row(4)) ' log result = 'row 4 = 1'
If Row(4) = 1 Then
checkbox1.Checked = True
Log("should now be checked")
End If

The checkbox doesn't get updated and the Log message "should now be checked" doesn't get shown in the logs.
 

atiaust

Active Member
Licensed User
Longtime User
Solved.

The value of Row(4) got converted to a string so the test for 1 doesn't work but "1" does.
 

Cableguy

Expert
Licensed User
Longtime User
If you must check for an integer, than you must convert your value into one:

dim rowvalue as int = row(4)

then use rowvalue in your If statement
 
Top