using System; using System.Windows.Forms; using System.Drawing; class ex : Form { TextBox tb1 = new TextBox(); ex() { Text = "hello"; tb1.Location = new Point(0, 25); Controls.Add(tb1); MenuStrip ms = new MenuStrip(); Controls.Add(ms); ToolStripMenuItem mi1 = new ToolStripMenuItem("File"); ms.Items.Add(mi1); ToolStripMenuItem mi2 = new ToolStripMenuItem("Example"); mi2.Click += new EventHandler(Example_Click); mi1.DropDownItems.Add(mi2); } void Example_Click(object sender, EventArgs e) { tb1.Text = "hi"; } static public void Main() { Application.Run(new ex()); } }