Thanks in advance
public frmUI4Properties()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
MessageBox.Show("First Constructor");
//
// TODO: Add any constructor code after InitializeComponent call
//
}
public frmUI4Properties(string Hello)
{
//???How can I call the first constructor ?
MessageBox.Show(Hello + "Second contructor);
}
You should use the "this" keyword to instruct the second constructor to
call your default constructor. Please note that if you call your second
constructor, then the call will *first* be forwarded to your default
constructor and then the constructor you called.
public frmUI4Properties()
{
InitializeComponent();
MessageBox.Show("First Constructor");
}
public frmUI4Properties(string Hello) : this()
{
MessageBox.Show(Hello + "Second contructor);
}
If you have more consturctors and you want to call a specific overload
then you just provide the right parameters, in the correct order, to the
this() statement.
Hope this helps,
//Andreas
"genc ymeri" <genc_...@hotmail.com> skrev i meddelandet
news:ekxPVVSE...@tk2msftngp13.phx.gbl...
"Andreas Håkansson" <andy.h (at) telia.com> wrote in message
news:ul5KraSE...@TK2MSFTNGP09.phx.gbl...
with regards,
J.V.Ravichandran
- http://www.geocities.com/
jvravichandran
- http://www.411asp.net/func/search?
qry=Ravichandran+J.V.&cob=aspnetpro
- http://www.southasianoutlook.com
- http://www.MSDNAA.Net
- http://www.csharphelp.com
- http://www.poetry.com/Publications/
display.asp?ID=P3966388&BN=999&PN=2
- Or, just search on "J.V.Ravichandran"
at http://www.Google.com
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
See http://www.pobox.com/~skeet/csharp/constructors.html
--
Jon Skeet - <sk...@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
"Jon Skeet [C# MVP]" <sk...@pobox.com> wrote in message
news:MPG.1acb4daca...@msnews.microsoft.com...
Huh ????
"Ravichandran J.V." <jvravic...@yahoo.com> wrote in message
news:eXCNKgW...@TK2MSFTNGP12.phx.gbl...