CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2005
    Posts
    1,030

    Where to place the initialization code in VC++.net?

    Is it a constructor or a function called InitializeComponent? Also would you please explain why? Thank you very much!

  2. #2
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: Where to place the initialization code in VC++.net?

    You put initialisation code for non-UI classes in the constructor.

    You shouldn't be editing the InitializeComponent part of any control as this is VC++ generated : you'll more likely than not either muck up the designer view or lose your code the next time you edit the control.

    If you're talking about a form you have the Load event, which I'd recommend. You can override the OnLoad virtual protected method in your derived form class and do your initialisation in there.

    Darwen.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured