R
R_O_O_K
Hi!
If the static Main method belongs to some class should it have access to
the class' private members? IMHO it shouldn't be so. Does anyone know
what the C# spec says? Here is a code example that compiles fine on
VC# 2002.
class Class1
{
[STAThread]
static void Main(string[] args)
{
Class1 cls = new Class1();
Form frm = new Form();
PrintPreviewControl ppv = new PrintPreviewControl();
ppv.Parent = frm;
ppv.Dock = DockStyle.Fill;
frm.Show();
PrintDocument doc = new PrintDocument();
ppv.Document = doc;
// here's the call to cls' private member
doc.PrintPage += new PrintPageEventHandler(cls.OnPrintPage);
Application.Run(frm);
}
private void OnPrintPage(object obj, PrintPageEventArgs ppea)
{
}
}
Regards!
Micha³ Ziemski
If the static Main method belongs to some class should it have access to
the class' private members? IMHO it shouldn't be so. Does anyone know
what the C# spec says? Here is a code example that compiles fine on
VC# 2002.
class Class1
{
[STAThread]
static void Main(string[] args)
{
Class1 cls = new Class1();
Form frm = new Form();
PrintPreviewControl ppv = new PrintPreviewControl();
ppv.Parent = frm;
ppv.Dock = DockStyle.Fill;
frm.Show();
PrintDocument doc = new PrintDocument();
ppv.Document = doc;
// here's the call to cls' private member
doc.PrintPage += new PrintPageEventHandler(cls.OnPrintPage);
Application.Run(frm);
}
private void OnPrintPage(object obj, PrintPageEventArgs ppea)
{
}
}
Regards!
Micha³ Ziemski