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

Confusion over the UserControl_ReadProperties event

Status
Not open for further replies.

catalina36

Programmer
Aug 28, 2000
36
0
0
US
This is my first foray into creating ActiveX Controls. I’m having trouble understanding the cycle of reading/writing properties (i.e. persistence) that occurs when the host application moves from design mode to run mode and back. The book I’m reading states “that the first time we draw our control on a form, the ReadProperties event gets fired.” However, the results that I’m getting when experimenting with my first control seem to indicate that the ReadProperties event is NOT fired when the control is first drawn on the form.

In an attempt to solve this riddle I put debug.print statements in each of the relevant events of my ActiveX control. Below are the results that I cut and pasted from the immediate window. Anything labeled ‘My note:’ are comments I typed into the immediate window to indicate what was going to occur next.

'My note: Draw control on form
Initialize
Resize
'
'My note: Save Project prior to running
WriteProperties
'
'My note: Run the project
WriteProperties
Initialize
Resize
ReadProperties
'
'My note: Stop the Project
Initialize
Resize
ReadProperties
WriteProperties

Contrary to what the book says, this indicates that the ReadProperties event does not get fired the first time the control is drawn onto the host form. Can somebody please tell me what’s really going on?

One other curious thing: Why when I stopped running the project/app (i.e. returned to design mode) did the WriteProperties event occur after the others? I would have thought that the order of events would have been the same as when I ran the project/app!?

TIA,
Jon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top