Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Data entering for DATE
Message
From
18/03/2007 01:10:35
Reza Meamar
Homa Programming Group
Shiraz, Iran
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP1
Miscellaneous
Thread ID:
01204943
Message ID:
01205124
Views:
24
>>>>dear all,
>>>>I want to have a textbox with below condition.
>>>>I want to get Date in character or date format as 2007/03/17
>>>>But with this order : first Day, second Month and third Year. that means from right to left order.
>>>>How can i do this?
>>>>Thanks
>>>
>>>In init event put
>>>
SET DATE YMD
>>
>>Yes , But this only change show type from 17/03/2007 to 2007/03/17.
>>but i want it shows as 2007/03/17 and when i want to enter date i can first enter day , so month and so year. but with SET DATE YMD, only showing order chanded and textbox get year so month so day.
>
>In init event of Form
>
>SET CENTURY ON
>SET DATE YMD
>
>
>In GotFocus of Textbox
>
SET DATE DMY
>
>and in Lostfocus of Textbox
>
SET DATE YMD
>
>But why,why?

Please see below code, i hope can show what i want.
thanks
Public oform1
oform1=createobject("form1")
oform1.Show
Return
*
DEFINE CLASS form1 AS form

	Top = 0
	Left = 0
	Height = 109
	Width = 185
	DoCreate = .T.
	Caption = "Form1"
	Name = "form1"


	ADD OBJECT text2 AS textbox WITH ;
		FontName = "Tahoma", ;
		BackStyle = 1, ;
		BorderStyle = 0, ;
		Value = "/", ;
		Enabled = .F., ;
		Height = 21, ;
		InputMask = "99", ;
		Left = 79, ;
		MaxLength = 2, ;
		ReadOnly = .T., ;
		SpecialEffect = 1, ;
		TabIndex = 5, ;
		Top = 12, ;
		Width = 9, ;
		BackColor = RGB(192,192,192), ;
		DisabledForeColor = RGB(0,0,0), ;
		Name = "Text2"


	ADD OBJECT text3 AS textbox WITH ;
		FontName = "Tahoma", ;
		BackStyle = 1, ;
		BorderStyle = 0, ;
		Value = "/", ;
		Enabled = .F., ;
		Height = 21, ;
		InputMask = "99", ;
		Left = 103, ;
		MaxLength = 2, ;
		ReadOnly = .T., ;
		SpecialEffect = 1, ;
		TabIndex = 6, ;
		Top = 12, ;
		Width = 9, ;
		BackColor = RGB(192,192,192), ;
		DisabledForeColor = RGB(0,0,0), ;
		Name = "Text3"


	ADD OBJECT yeartxt AS textbox WITH ;
		FontName = "Tahoma", ;
		BorderStyle = 0, ;
		Enabled = .T., ;
		Height = 21, ;
		InputMask = "9999", ;
		Left = 48, ;
		MaxLength = 4, ;
		SelectOnEntry = .T., ;
		SpecialEffect = 1, ;
		TabIndex = 3, ;
		Top = 12, ;
		Width = 33, ;
		BackColor = RGB(255,128,255), ;
		Name = "YearTxt"


	ADD OBJECT monthtxt AS textbox WITH ;
		FontName = "Tahoma", ;
		BorderStyle = 0, ;
		Enabled = .T., ;
		Height = 21, ;
		InputMask = "99", ;
		Left = 86, ;
		MaxLength = 2, ;
		SelectOnEntry = .T., ;
		SpecialEffect = 1, ;
		TabIndex = 2, ;
		Top = 12, ;
		Width = 19, ;
		BackColor = RGB(255,128,255), ;
		Name = "MonthTxt"


	ADD OBJECT daytxt AS textbox WITH ;
		FontName = "Tahoma", ;
		BorderStyle = 0, ;
		Enabled = .T., ;
		Height = 21, ;
		InputMask = "99", ;
		Left = 110, ;
		MaxLength = 2, ;
		SelectOnEntry = .T., ;
		SpecialEffect = 1, ;
		TabIndex = 1, ;
		Top = 12, ;
		Width = 19, ;
		BackColor = RGB(255,128,255), ;
		Name = "DayTxt"


	ADD OBJECT text1 AS textbox WITH ;
		FontName = "Tahoma", ;
		Alignment = 3, ;
		Value = {}, ;
		Enabled = .T., ;
		Format = "", ;
		Height = 23, ;
		InputMask = "", ;
		Left = 48, ;
		Top = 51, ;
		Width = 80, ;
		Name = "Text1"


	PROCEDURE Init
		SET CENTURY ON
		SET DATE YMD
	ENDPROC


	PROCEDURE text1.GotFocus
		SET DATE DMY
	ENDPROC


	PROCEDURE text1.LostFocus
		SET DATE YMD
	ENDPROC


ENDDEFINE
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform