Button button = new Button(); button.Name = "btnClick"; button.Text = "Click me"; button.Width = 100; button.Height = 30;
Button btnClick = new Button(); btnClick.Name = "btnClick"; btnClick.Text = "Click me"; btnClick.Width = 100; btnClick.Height = 30; btnClick.Click += new EventHandler(btnClick_Click); private void btnClick_Click(object sender, EventArgs e) { // Code to be executed on button click }The Button class is part of the System.Windows.Forms namespace, which is contained in the System.Windows.Forms.dll package library.