// Vijaykumar Patil and Emil Tsankov // ISOM 6930 Dr. Ahmed // Assignment 8 Due Date Nov. 2,2001 // Window Application from Command prompt using System; using System.Drawing; using System.Windows.Forms; public class frmFirstForm:Form { private Label lblResult; private Label lblTitle; private Button btnAdd; private Button btnExit; private TextBox txt1; private TextBox txt2; private EventHandler handler; // Constructor public frmFirstForm() { ClientSize = new System.Drawing.Size(400,300); StartPosition = FormStartPosition.CenterScreen; lblResult = new Label(); lblResult.Size = new Size(50,30); lblResult.Location = new Point(175,110); lblResult.Text=" "; Controls.Add(lblResult); lblTitle = new Label(); lblTitle.Size = new Size(100,100); lblTitle.Location = new Point(100,10); lblTitle.Text=" Add two numbers "; Controls.Add(lblTitle); txt1 = new TextBox(); txt1.Size = new Size(80,30); txt1.Location = new Point(50,40); txt1.Text=" "; Controls.Add(txt1); txt2 = new TextBox(); txt2.Size = new Size(50,30); txt2.Location = new Point(210,40); txt2.Text=" "; Controls.Add(txt2); handler = new EventHandler(oneFunction); btnAdd = new Button(); btnAdd.Size = new Size(80,30); btnAdd.Location = new Point(10,210); btnAdd.Text=" Add "; btnAdd.Click += handler; Controls.Add(btnAdd); btnExit = new Button(); btnExit.Size = new Size(80,30); btnExit.Location = new Point(210,210); btnExit.Text=" Exit "; btnExit.Click += handler; Controls.Add(btnExit); } private void oneFunction(Object source, EventArgs e) { if(source==btnExit) Application.Exit(); if(source==btnAdd) { lblResult.Text=" " +(Int32.Parse(txt1.Text)+Int32.Parse(txt2.Text));} } public static void Main() { Application.Run(new frmFirstForm()); } }