using System; using System.Windows.Forms; class MySimpleForm : Form { public MySimpleForm() { Button button = new Button(); button.Text = "My Button"; button.Click += new EventHandler(OnClick); this.Controls.Add(button); } void OnClick(Object sender, EventArgs args) { MessageBox.Show("The Button Was Clicked!"); } } class App { public static void Main() { Application.Run(new MySimpleForm()); } }