>>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)
> ....
>endif
>
>HTH,
Thanks Hilmar - that would be better than:-)
if ((vartype(checkbox.value)="L" and checkbox.value=.t.) or ;
(vartype(checkbox.value)="N" and checkbox.value=1)) and ;
!vartype(checkbox.value)="U"
checkbox=.t.
endif
It could go on forever
Imagination is more important than knowledge