Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Apply to text box (Age Calculator)
Message
From
14/03/2005 03:46:29
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00995253
Message ID:
00995394
Views:
17
hi,
you main i must creat newform and put text1,2...and labels and command.

thanks.
>>hi,
>>i try to run your code ,
>>but i get error message age.vcx dose not exist.
>>i use vfp7.
>>thanks.
>>
>Mohammed, first convert Age.prg in Age.vcx
>You need to have Age.vcx in default folder.
>Then You can Run code below.

>
>>>>How Age Calculator apply to text box. Downloade id (25738)
>>>>if text box value is :11/04/1960 and getting from today date
>>>
>>>Khubaib,
>>>IF You have convert age.prg to vcx try this code:
>>>
>>>PUBLIC oform1
>>>SET CENTURY ON
>>>oform1=NEWOBJECT("myform")
>>>oform1.Show
>>>RETURN
>>>
>>>DEFINE CLASS myform AS form
>>>	Top = 16
>>>	Left = 62
>>>	Height = 250
>>>	Width = 282
>>>	DoCreate = .T.
>>>	Caption = "Form"
>>>	ox = .F.
>>>
>>>	ADD OBJECT text1 AS textbox WITH ;
>>>		Alignment = 3, ;
>>>		Height = 23, ;
>>>		Left = 104, ;
>>>		TabIndex = 1, ;
>>>		Top = 28, ;
>>>		Width = 103, ;
>>>		Name = "Text1"
>>>
>>>	ADD OBJECT label1 AS label WITH ;
>>>		Alignment = 1, ;
>>>		Caption = "FROM:", ;
>>>		Height = 19, ;
>>>		Left = 40, ;
>>>		Top = 30, ;
>>>		Width = 49, ;
>>>		TabIndex = 4, ;
>>>		Name = "Label1"
>>>
>>>	ADD OBJECT label2 AS label WITH ;
>>>		Alignment = 1, ;
>>>		Caption = "TO:", ;
>>>		Height = 19, ;
>>>		Left = 40, ;
>>>		Top = 68, ;
>>>		Width = 49, ;
>>>		TabIndex = 5, ;
>>>		Name = "Label2"
>>>
>>>	ADD OBJECT text2 AS textbox WITH ;
>>>		Alignment = 3, ;
>>>		Height = 23, ;
>>>		Left = 104, ;
>>>		TabIndex = 2, ;
>>>		Top = 68, ;
>>>		Width = 103, ;
>>>		Name = "Text2"
>>>
>>>	ADD OBJECT command1 AS commandbutton WITH ;
>>>		Top = 183, ;
>>>		Left = 97, ;
>>>		Height = 38, ;
>>>		Width = 110, ;
>>>		Caption = "START", ;
>>>		TabIndex = 3, ;
>>>		Name = "Command1"
>>>
>>>	ADD OBJECT year AS textbox WITH ;
>>>		Enabled = .F., ;
>>>		Height = 23, ;
>>>		Left = 57, ;
>>>		TabIndex = 6, ;
>>>		Top = 130, ;
>>>		Width = 53, ;
>>>		Name = "Year"
>>>
>>>	ADD OBJECT month AS textbox WITH ;
>>>		Enabled = .F., ;
>>>		Height = 23, ;
>>>		Left = 123, ;
>>>		TabIndex = 7, ;
>>>		Top = 130, ;
>>>		Width = 53, ;
>>>		Name = "month"
>>>
>>>	ADD OBJECT day AS textbox WITH ;
>>>		Enabled = .F., ;
>>>		Height = 23, ;
>>>		Left = 186, ;
>>>		TabIndex = 8, ;
>>>		Top = 130, ;
>>>		Width = 53, ;
>>>		Name = "day"
>>>
>>>	ADD OBJECT label3 AS label WITH ;
>>>		Caption = "Year", ;
>>>		Height = 17, ;
>>>		Left = 57, ;
>>>		Top = 102, ;
>>>		Width = 47, ;
>>>		TabIndex = 9, ;
>>>		Name = "Label3"
>>>
>>>	ADD OBJECT label4 AS label WITH ;
>>>		Caption = "Month", ;
>>>		Height = 17, ;
>>>		Left = 125, ;
>>>		Top = 102, ;
>>>		Width = 47, ;
>>>		TabIndex = 10, ;
>>>		Name = "Label4"
>>>
>>>	ADD OBJECT label5 AS label WITH ;
>>>		Caption = "Day", ;
>>>		Height = 17, ;
>>>		Left = 190, ;
>>>		Top = 102, ;
>>>		Width = 47, ;
>>>		TabIndex = 11, ;
>>>		Name = "Label5"
>>>
>>>	PROCEDURE Init
>>>		ThisForm.ox = NEWOBJECT( "AgeCalculator", "age.vcx")
>>>		ThisForm.Text1.Value = DATE(1956,09,23)
>>>		ThisForm.Text2.Value = DATE()
>>>	ENDPROC
>>>
>>>	PROCEDURE command1.Click
>>>		ThisForm.ox.CalculateAge( ThisForm.Text1.Value,ThisForm.Text2.Value)
>>>		ThisForm.Year.Value  = ThisForm.ox.nYears
>>>		ThisForm.Month.Value = ThisForm.ox.nMonths
>>>		ThisForm.Day.Value   = ThisForm.ox.nDays
>>>	ENDPROC
>>>ENDDEFINE
>>>
Previous
Reply
Map
View

Click here to load this message in the networking platform