Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CheckBox forgets state
Message
From
20/01/2004 17:15:41
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00868781
Message ID:
00868783
Views:
18
>My app uses a checkbox to manage mousemove services. My convention is to use 0 for off and 1 for on.
>
>Somtimes, CheckBox forgets its a number, and VFP messages Operand/Data Type error. And sure enoug, when I look at the state recorded at last "bomb", the checkbox type has changed from numberical to logical.
>
>Maybe I should swith to a true/false application of check box?
>
>Oh yeah, it's VFP-8 and the crash happens inside a treeview mouse move when the question is asked:
>
if MyCheckBox.Value=0
>   ....
>endif
>
>Thanks

I had the problem the other way around (in VFP6): If I didn't specify a value, it was sure to be numeric, where I expected it to be logical (logical is more "logical" for T/F questions, isn't it?)

Make sure you assign the correct value in the property sheet, Init() method, etc.

Another option is to change the code in your example as follows:
if empty(MyCheckBox.Value) && works both for 0 and .F.
   ....
endif
HTH,

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform