Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP Changes its mind over Checkbox
Message
From
04/07/2006 09:52:47
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01133547
Message ID:
01133580
Views:
15
>>>>Terry,
>>>>
>>>>Checkboxes can have 3 values
>>>>
>>>>if (vartype(m.this.Value) == T_LOGICAL )
>>>> TRUE, FALSE or NULL
>>>>
>>>>else >> Numeric
>>>> 0, 1, or 2= null
>>>>endif
>>>>
>>>>If, in your case it can only be true/false or 0/1, use empty(m.this.Value)
>>>>
>>>>You can force its type to be logical by
>>>> (1) binding it to a logical Field, or
>>>> (2) if it does not have a controlsource, setting its default value to .T./.F. in the class
>>>
>>>Hi Greg
>>>
>>>Yes I knew this (as I indicated in my spiel), and that one can set the default value (as I said I now have done), etc. My beef is that I put the checkbox on the form, wrote code to accommodate it, then it went and changed its data type from T/F to 1/0.
>>>
>>>Cheers
>>>
>>>Terry
>>
>>Terry,
>>
>>Change your test to if( !empty(...Value) ) instead of if( ...Value ).
>
>Thanks, Greg but what test are you talking about?


The operator/operand type error of your first message

Testing Empty() works on both numeric and logical data types
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform