Following program is in a book. It is executing. But I couldn't understand the logic because Text on the Button should come after creating a Button. Problem is highlighted.
using System;
using System.Windows.Forms;
using System.Drawing;
public class WindowWithButton : Form
{
 Button button1 = new Button();
 public WindowWithButton() 
 {
 this.Size = new Size(300, 300); 
 this.Text = "Window Object With Button"; 
 button1.Text = "Press"; 
 this.Controls.AddRange(new System.Windows.Forms.Control[] { this.button1 });// Creating a Button
 
 this.button1.Location = new Point(100, 50);
 
 }
 public static void Main()
 {
 Application.Run(new WindowWithButton());
 }
}