Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

logical value with check boxes vfp7

Status
Not open for further replies.

fitedgar

MIS
Apr 24, 2002
238
US
I can't seem to change the value of a check box to .t. or .f.. Data mismatch error. It only allows 1 , 0 or 2

I want to use it as follows:

IF thisform.chkbox.value = .t.
do this..

ENDIF
am I stuck with : IF thisform.chkbox.value = 1
Thank you in advance
EMC
 
Put the value of the checkbox to .F., here is a sample :
Code:
PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show
RETURN
DEFINE CLASS form1 AS form
	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"
        ADD OBJECT check1 AS checkbox WITH ;
		Top = 72, ;
		Left = 156, ;
		Height = 17, ;
		Width = 60, ;
		Caption = "Check1", ;
		Value = .F., ;
		Name = "Check1"
	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 156, ;
		Left = 156, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Command1", ;
		Name = "Command1"
	PROCEDURE command1.Click
		thisform.check1.Value = !thisform.check1.Value
	ENDPROC
ENDDEFINE
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first or check this link
 
Thank you for your response, however, my problem is probably
simpler.
I need to initialize the check boxes value ,on a form, to be logical.
Thank you
 
fitedgar

I need to initialize the check boxes value ,on a form, to be logical.

Sorry, I wasn't clear in my response when I said :Put the value of the checkbox to .F.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first or check this link
 
Thanks Mike,however...
VFP7
In my form for some reason,the value propery for a check box only allows 1 , 0 or 2, not .t. or .f.

I resolved it as follows in the calling program:

lc_check = .t.

(in the form i have the check box's control source property as lc_check., the value property as default ( 1 ) )

DO FORM testform


Now i can use it as follows:
IF (thisform.checbox.value)
do this..

ENDIF
Thank you in advance
 
fitedgar

VFP7
In my form for some reason,the value propery for a check box only allows 1 , 0 or 2, not .t. or .f.


That is news to me.
[ol][li]Create a blank form[/li]
[li]Put a checkbox on it[/li]
[li]In the property sheet, change the Value property to .F.[/LI][/OL]

Works for me in VFP5.0, VFP6.0,VFP7.0 and VFP8.0 beta.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first or check this link
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top