[2005] Constructor question
How can I put additional method if I want to add a constructor. Like example with Form Class, when I add constructor, it always add a method called InitializeComponent() and a comment
vb Code:
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
End Sub
Regards
Michael
Re: [2005] Constructor question
Feel free to insert any other method calls or code you want in there. InitializeComponent is always called regardless of whether you explicitly create the constructor or not. Basically it just initializes all the controls and components on the form and shows them. You can add other method calls after you call that one.
Re: [2005] Constructor question
What I mean is, when I insert a constructor in a form class, it always insert InitializeComponent() automatically. I want my class has this ability too, since my class is inherited by several class and all of them must initiate the same method if I insert a constructor...
Re: [2005] Constructor question
I'm not really sure what you mean. You wrote your own class? Is it inheriting from the System.Windows.Forms.Form class? You can call the InitializeComponent method wherever you want, even if the constructor is overloaded.
Maybe I'm just tired but I can't fully understand what you mean.
Re: [2005] Constructor question
You can create your own ItemTemplate in VS2005 that will construct a default class with any comments or methods already defined. Try search google for ItemTemplate example.
http://msdn.microsoft.com/msdnmag/is...CodeTemplates/