Hello everybody. I have an UC that raises errors when certain conditions are met. It works fine if there is only one instance of the UC, otherwise there is trouble. I'm sending attached the project. Remember it's not finished, so if you want to play with it, only the "bold", "italics" and "underlined" buttons are enabled. And I still haven't implemented context sensitivity, i. e. if you select a bold part the button doesn't automatically show as selected. To reproduce my problems do the following. First of all download the project and copy the bitmaps to the c:\ directory. Compile the ocx. Then:
1) First scenario:
a) Open a standard EXE project. Form1 is added by default.
b) Add the ocx to the project components
c) Insert an instance of the ocx into Form1
d) Add a usercontrol to the project (click Project -> Add User Control)
e) Insert an instance of my ocx into the usercontrol.
Problems:
a) you'll see that the error is raised. However I verified it to be raised on the resize event, and not on the InitProperties event as it should be according to my code.
b) Close the new UC and launch the project. The following error occurs:
"License information for this component not found. You do not have an appropriate license to use this functionality in the design environment"
2) Second scenario:
a) Open a standard EXE project. Form1 is added by default.
b) Add the ocx to the project components
c) Insert an instance of the ocx into Form1
d) Write the following code into Form1:
Code:
Private Sub Form_Load()
Dim a As VBControlExtender
Set a = Controls.Add("xxx.usercontrol1", "ctl") 'write the name of the ocx project in place of the xxx
End Sub
e) Launch the project
f) Launch the project again.
Problems:
a) When you launch the project for the first time, the error that should be raised by my code is not raised. Instead you'll get "Automation error", then "Can not call friend function on object which is not an instance of defining class", then again "Automation error"
b) The second time you launch the project you get "Automation error", then the error from my code, then again "Automation error". Then the application doesn't terminate regularly, and when you try closing it from the IDE, a crash occurs.
I'm at a total loss with these problems. Please help me. Thank you.
Last edited by dichelson; Jun 19th, 2009 at 04:09 PM.