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();
PrintPreviewCon trol ppv = new PrintPreviewCon trol();
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 PrintPageEventH andler(cls.OnPr intPage);
Application.Run (frm);
}
private void OnPrintPage(obj ect obj, PrintPageEventA rgs 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();
PrintPreviewCon trol ppv = new PrintPreviewCon trol();
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 PrintPageEventH andler(cls.OnPr intPage);
Application.Run (frm);
}
private void OnPrintPage(obj ect obj, PrintPageEventA rgs ppea)
{
}
}
Regards!
Micha³ Ziemski
Comment