A Puzzler control problem

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

Here's a question for you all.

1. I have in my application a control named CommonControl.
CommonControl is inherited by a number of other controls in order to
create semi-polymorphic controls. In the CommonControls load routine
there is some code in order to attach to a device over the serial comms
port. Now whenever I open one of my other controls which inherits the
commonControl at design time. It appears to be running the code in the
commoncontrol's load routine. This is causing my SerialCom port to
lock up and become unusable until I restart the application. Any
Idea's why it is running the code in the Load routine of the
CommonControl when I am designing forms?

2. I am also having a problem with a number of stupid errors when I try
to compile my code to access the com ports. I have 3 classes all
designed to assist in the controling of the serial communications and
occasionally.... not always... I get the error that they were unable to
compile due to an error writing to the Debug information file of the
DLL's and then if i try to compile again, i get a number of further
messages telling me it cannot write to the DLL's either. I have
managed to rectify this situation by closing visual studio and deleting
all of the files that it cannot write to and then opening visual
studio. This seems to work but it is becoming increasingly more
annoying! I end up doing it about 10 times a day! It isn't fun but i
think this problem may have something to do with problem 1!

Dave
 
Dave said:
Here's a question for you all.

1. I have in my application a control named CommonControl.
CommonControl is inherited by a number of other controls in order to
create semi-polymorphic controls. In the CommonControls load routine
there is some code in order to attach to a device over the serial comms
port. Now whenever I open one of my other controls which inherits the
commonControl at design time. It appears to be running the code in the
commoncontrol's load routine. This is causing my SerialCom port to
lock up and become unusable until I restart the application. Any
Idea's why it is running the code in the Load routine of the
CommonControl when I am designing forms?

The designer must create your control to show it on the designer window.
It's the same as if your application is running and you show a Form
containing the control. Thus, in both cases, the load event is fired.

In your control, you can check Me.Designmode to see if the designer created
the control itself. The property returns only true if the control is
directly placed on the designer, i.e. on the Form. If it is contained in a
Usercontrol and you put the Usercontrol in the Form, the Designmode property
is False again. Therefore, you must rethink whether the com port is opened
merely by creating the control, or if it's better to do this at a different
time.

Sorry, no solution from me.


Armin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top