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

How can we pass value of ActiveX Control 1

Status
Not open for further replies.

rkm500

Programmer
Apr 26, 2003
12
US
Hello,
I'am try to use Microsoft date-time picker ActiveX control object on my form.

How can I get the value of selected date and time in a text box:

My codes are as follows:

Microsoft DateTime PIcker Control object name : Olecontrol1

Text Box name: text1

I want the datetime value of Olecontrol1 object on text1 after at Click.

The click event codes of Text1 is:
thisform.text1.value=thisform.olecontrol1.value

When form is run, at text1 click, it returns Property value not found..

What does it mean..

Please help me in resolving this issue....

I'm using VFP7.0
 
Apparently the datetime picker has a really odd structure.

It appears that there is an internal 'item' within the control called object.

Try

thisform.text1.value = thisform.olecontrol1.object.value

 
RKM500,

The DataPicker does not have a Value property. It has separate properties for Year, Month and Day.

You can obtain the selected date as follows:

WITH THIS
dDate = DATE(.Year,.Month.,Day)
ENDWITH

Mike


Mike Lewis
Edinburgh, Scotland
 
Mike


The DataPicker does not have a Value property.

I beg to differ...fluteplr is right, it does have a value, its just one step further in.

Code:
PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.addobject("olecontrol1","olecontrol1")

oform1.Show
RETURN
DEFINE CLASS form1 AS form
	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"
	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 144, ;
		Left = 108, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Command1", ;
		Name = "Command1"
	PROCEDURE command1.Click
		messagebox(thisform.olecontrol1.oBJECT.Value)
	ENDPROC
ENDDEFINE
DEFINE CLASS oleControl1 as OleControl
  oleclass = "MSComCTL2.DTPicker.2"
  visible = .t.
  width = 100
  height = 20
ENDDEFINE

Mike Gagnon

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

Part and Inventory Search

Sponsor

Back
Top