VS Form-Designer executing form code.

  • Thread starter Thread starter SR
  • Start date Start date
S

SR

Hi there,
I'm facing a little problem:

I got a class named childBase that inherites from Window.form.
I got another form somewhere that inherites childBase.

I got some code in the childBase_Load event.

My problem is that when I'm trying to design some forms that inherites
from childBase, I got an error and I'm not able to design anything.

The error comes from the fact that VS creates an instance of the form
and then fired the childBase_Load event. The thing is that the code in
that event is not ready to be executed "from" the designer (it's trying
to find some files but in that case it is looking in the c:\progfiles\ms
vs\common7something\ dir, so it fails.)

It should be cool to be able to desable the execution of the code of the
childBase_Load sub when in design mode. There maybe an attribute but I
can't find it.

If you got any ideas ...
 
You could check the DesignMode property of the form and only execute if
that is false.

If Not Me.DesignMode Then
'Code here
End If

Just a thought
 
Back
Top