/* C# Programming Tips & Techniques by Charles Wright, Kris Jamsa Publisher: Osborne/McGraw-Hill (December 28, 2001) ISBN: 0072193794 */ using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; namespace Form { /// <summary> /// Summary description for ButtonTextForm. /// </summary> public class ButtonTextForm : System.Windows.Forms.Form { private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; private System.Windows.Forms.TextBox textBox1; /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.Container components = null; public ButtonTextForm() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.textBox1 = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // // button1 // this.button1.Location = new System.Drawing.Point(61, 159); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(85, 37); this.button1.TabIndex = 1; this.button1.Text = "button1"; // // button2 // this.button2.Location = new System.Drawing.Point(196, 159); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(95, 37); this.button2.TabIndex = 2; this.button2.Text = "button2"; // // textBox1 // this.textBox1.Location = new System.Drawing.Point(41, 37); this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(262, 22); this.textBox1.TabIndex = 0; this.textBox1.Text = "textBox1"; // // ButtonTextForm // this.AutoScaleBaseSize = new System.Drawing.Size(6, 15); this.ClientSize = new System.Drawing.Size(340, 280); this.Controls.AddRange(new System.Windows.Forms.Control[] { this.button1, this.button2, this.textBox1}); this.Name = "ButtonTextForm"; this.Text = "ButtonTextForm"; this.Load += new System.EventHandler(this.ButtonTextForm_Load); this.ResumeLayout(false); } #endregion /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.Run(new ButtonTextForm()); } private void ButtonTextForm_Load(object sender, System.EventArgs e) { } private void button2_Click(object sender, System.EventArgs e) { Application.Exit (); } private void button1_Click(object sender, System.EventArgs e) { MessageBox.Show (this, textBox1.Text, "Text Box", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); } } }