Hi Tom!
You can do it like this:
public CommentDlg()
{
// this is my default constructor
}
public CommentDlg(string comment) : this ()
{
// some code here
}
when you call CommentDlg(string comment) constructor, CommentDlg() will
execute first and then CommentDlg(string comment)...
ofcource, you can call other constructor too, like this:
public CommentDlg() {}
public CommentDlg(string comment) : this () {}
public CommentDlg(string someData, int hello) : this (someData) {}
if you call public CommentDlg(string someData, int hello), execution order
is:
1. public CommentDlg() {}
2. public CommentDlg(string comment) : this () {}
3. public CommentDlg(string someData, int hello) : this (someData) {}
hope this helps...
Jeti
public class CommentDlg : System.Windows.Forms.Form
{
[...]
public CommentDlg()
{
InitializeComponent();
}
public CommentDlg(string comment)
{
CommentDlg(); // <<<--- this generates a compile error
Comment = comment;
}
[...]
}