Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / August 2006

Tip: Looking for answers? Try searching our database.

InitializeComponent() No Longer Being called

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paul - 07 Aug 2006 12:16 GMT
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.
Joanna Carter [TeamB] - 07 Aug 2006 12:34 GMT
| 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
[quoted text clipped - 6 lines]
| 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

Signature

Joanna Carter [TeamB]
Consultant Software Engineer

Paul - 07 Aug 2006 13:03 GMT
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).

> | I've just run into a problem where my windows form displays correctly in
> the
[quoted text clipped - 26 lines]
>
> Joanna

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.