namespace app01; public partial calss Form1 : Form { Button button = new Button(); public Form1() { button.Text = "Mehet"; button.Location = new Point(50, 50); button.Click += new EventHandler(Button_Click); this.Controls.Add(button); this.Width = 400; this.Height = 300; this.Show(); } private void Button_Click(object? sender, EventArgs e) { MessageBox.Show("Működik"); } }