I have setup a dialogue box with two radio buttons and allocated B1 as a variable for it, having a value of either 0 or 1 depending on the choice of radio button.
I then use Select Case to examine the value of B1 and find that Case 0 and Case 1 doesn't work, but Case False and Case True does. My code is:
if DlgState = "IDOk" then Select Case B1 Case False Call ScriptStart("GetData") Case True Call ScriptStart("GetContData") End Select else Flag = 0 Call Err.Raise (-1) 'Autoquit end if
A similar dialogue box written by a colleague uses the same concept for the radio buttons and variable, but his code works because he uses an If statement to determine the value of B1. His code is:
B1=0 Call SUDDlgShow("Decimate") if DlgState <> "IDOk" then Call Err.Raise (-1) 'Autoquit end if If B1=0 Then NoPts = Val(T1) Else NoPts = L2/Val(T1) End If
Why the difference in behaviour with the use of B1?
Solved! Go to Solution.
The confusion deepens. You seem to have proved that B1 cannot use 0 or 1, and must use True or False instead.
I tested my colleague's code and it seems you are correct. His code only worked because he used "If B1=0" and "Else", which is the only case that turns out true in your experiment!! I have changed his code to use True and False.
However, the DIAdem help files state that a Boolean variable type can take the values TRUE, FALSE or "YES", "NO" or 1, 0. See here for example in 2018 online help. Not at all helpful!!