// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Drawing; using System.Windows.Forms; namespace DefaultNamespace { public class MainForm : Form { private Label label1; public MainForm() { InitializeComponent(); } [STAThread] public static void Main(string[] args) { Application.Run(new MainForm()); } private void InitializeComponent() { label1 = new Label(); SuspendLayout(); label1.Location = new Point(50, 100); label1.Name = "label1"; label1.Size = new Size(150, 50); label1.TabIndex = 0; label1.Text = ""; AutoScaleBaseSize = new Size(5, 10); ClientSize = new Size(300, 275); Controls.Add(label1); Name = "MainForm"; Text = "MainForm"; ResumeLayout(false); HelperClass hc = new HelperClass(this); hc.doit(); } public void setLabel1(string lbl) { label1.Text = lbl; } } public class HelperClass { private MainForm mf; public HelperClass(MainForm mf) { this.mf = mf; } public void doit() { mf.setLabel1(DateTime.Now.ToString()); } } }