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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DTpicker activeX value prob

Status
Not open for further replies.

Holm78

Programmer
Mar 5, 2002
60
SE
Hello all


I have recently installed VFP 8.0 and SP1.

My prob is that a add a DTpicker (any kind that comes with VFP) to my form and all looks good but when I want to use the value property it does not find it.

If i mark the DTpicker and look in propertys the value does not exist... but when i code in the click event the value property appears... Then when I run the prog, it can´t find the property value??

Help needed?
 
Holm78

Try using the "Object.value". 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 olecontrol1 AS olecontrol WITH ;
		Top = 48, ;
		Left = 108, ;
		Height = 24, ;
		Width = 204, ;
		Name = "Olecontrol1", ;
		OleClass = "MSComctl2.DTPicker.2"
	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 108, ;
		Left = 156, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Value ", ;
        	Name = "Command1"
	PROCEDURE command1.Click
		MESSAGEBOX(thisform.olecontrol1.object.Value)
	ENDPROC
ENDDEFINE


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Holm78,

As you have discovered, the dtPicker does not have a Value property. However, it does have year, month and day properties, so you could get the value like so:

with thisform.MyDtPicker
MyValue = DATE(.Year, .Month, .Day)
endwith

Alternatively, as Mike Gagnon suggested, use the underlying Object to get the value:

with thisform.MyDtPicker
MyValue = .Object.Value
endwith

Hope this helps.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Thanks guys....

.object.value did the trick...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top