InitializeComponent() No Longer Being called

P

Paul

Hi,

I've just run into a problem where my windows form displays correctly in the
VS IDE designer (#2.0), but has started appearing as a blank (default) form
at run time (it used to work). Using break points I've noticed that
InitializeComponent() does not appear to be called for this form, so none of
my components are being set up. If I rename "InitializeComponents()" I get
the same issue in design mode. Has anyone else run into this before, I'm
not completely sure how the design time editor can be happy with the code
and display my form correctly, but the run time engine does not. Is this
some form of corruption that will require me to recreate my form - or is
there a work around?

Please forgive me if this is a common question, I've searched the forums and
google'd but didn't find anything similar.

- Paul.
 
J

Joanna Carter [TeamB]

"Paul" <[email protected]> a écrit dans le message de (e-mail address removed)...

| I've just run into a problem where my windows form displays correctly in
the
| VS IDE designer (#2.0), but has started appearing as a blank (default)
form
| at run time (it used to work). Using break points I've noticed that
| InitializeComponent() does not appear to be called for this form, so none
of
| my components are being set up. If I rename "InitializeComponents()" I
get
| the same issue in design mode. Has anyone else run into this before, I'm
| not completely sure how the design time editor can be happy with the code
| and display my form correctly, but the run time engine does not. Is this
| some form of corruption that will require me to recreate my form - or is
| there a work around?

Are you calling the default parameterless constructor provided, or are you
using another one at runtime and not calling it at all ?

public Form1()
{
InitializeComponent();

...
}

Joanna
 
P

Paul

Thank you for indirectly solving my problem bit of a homer simpson "Duh!"
required, commenting out some code in my forms default constructor had
included the "InitializeComponent" call (so of course it wasn't being called
a runtime). I'd only out a breakpoint in the formload and
initializecomponent() methods so missed this ever so slightly obvious issue.
Thanks once again. I guess that the designer calls initializecomponent
without calling the form constructor (which makes sense).
 

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

Top