Help with ActiveX control property references 
Author Message
 Help with ActiveX control property references

I am having intermittent problems with an ActiveX control in a VFP6 form;
specifically, the MS DateTime Picker v6 that came with Visual Studio.

The control was added to the form by selecting it from the form control
toolbar ActiveX section which was set up using the VFP Options screen.

The control is used, along with supporting controls, to define the start
date for reporting calculations.  If the user wants to start with (say) July
1998, or Second Quarter 1999, there are combo boxes to pick "July" or "First
Quarter" and a spinner to pick 1999.  Behind the scenes, the DateTime picker
maintains the calculated date for these choices.  It is used directly if the
user wants to pick a specific date for the report calculations.

Infrequently, when the code attempts to set the Month property of the
DateTime picker, as with:

ThisForm.oleDatePicker.Month = Month(ldCalculatedDate)

I receive the error message:

OLE lDispatch exception code 0 from DTPicker: Invalid property value..

The same error message will occur if I force-feed, say Year = 5 or Month = 0
to the control, but I display the values that are about to be passed before
the error message, and they are legitimate date values (year = 1998, month =
6, day = 1).

While the error is intermittent in that identical input will not always
cause the problem, once it occurs in a session, the frequency seems to
increase.

I am aware of the use of "object" to access activex properties, but changing
the code to

ThisForm.oleDatePicker.object.Month = Month(ldCalculatedDate) and
equivalently throughout the form was much worse: the form would not run at
all.  I got all sorts of complaints about the use of "object", so I took
them out.

There must be something I'm missing:  I don't believe that Fox is as flaky
with standard ActiveX controls like this as it appears to be.  What am I
missing?

Thanks for any suggestions
Bruce



Wed, 08 Aug 2001 03:00:00 GMT  
 Help with ActiveX control property references
Bruce,

Use the Object reference in your code, as in;

Thisform.oleDatePicker.Object.Month = Month(ldCalculatedDate)
                                           ^^^^^^

This clears the reference form being to the OLE container to the object
inside that container.

--
JimB
www.jamesbooth.com



Sun, 12 Aug 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Binding memo fields to ActiveX control properties

2. WordPad Doc ActiveX control properties

3. Calendar ActiveX control - ControlSource Property

4. HELP! picclip ActiveX control and the image control

5. Expert help requested -passing class properties to UDFs by reference

6. Expert help requested -passing class properties to UDFs by reference

7. Need Help: ActiveX TabStrip control won't behave

8. ActiveX: help with the Rich Text Control

9. Need help creating a progressbar with the activex control

10. Activex Picture controls help!

11. need help on ActiveX Control

12. HELP!!! ActiveX control value in VFP6

 

 
Powered by phpBB® Forum Software