Mega Code Archive

 
Categories / C# Tutorial / GUI Windows Forms
 

Customer Entry Application with TabControl

using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data;   public class Form1 : Form   {     private TabControl tabControl1;     private TabPage tabPage1;     private TabPage tabPage2;     private TabPage tabPage3;     private Label formLabel;     private TextBox lastNameTextBox;     private Label lastNameLabel;     private TextBox miTextBox;     private Label middleInitialLabel;     private TextBox firstNameTextBox;     private Label firstNameLabel;     private TextBox zipCodeBox;     private ComboBox stateBox;     private Label stateLabel;     private TextBox cityBox;     private Label cityLabel;     private TextBox streetTextBox;     private Label streetLabel;     private RadioButton NoRadioButton;     private RadioButton YesRadioButton;     private CheckBox Over35Box;     private CheckBox B1835Box;     private CheckBox Under18Box;     private Label marriedLabel;     private Label ageGroupLabel;     private Button NewButton;     private Button UpdateButton;     private Button DeleteButton;     private System.ComponentModel.Container components = null;     public Form1()     {       this.tabControl1 = new TabControl();       this.tabPage1 = new TabPage();       this.tabPage2 = new TabPage();       this.tabPage3 = new TabPage();       this.formLabel = new Label();       this.lastNameTextBox = new TextBox();       this.lastNameLabel = new Label();       this.miTextBox = new TextBox();       this.middleInitialLabel = new Label();       this.firstNameTextBox = new TextBox();       this.firstNameLabel = new Label();       this.zipCodeBox = new TextBox();       this.stateBox = new ComboBox();       this.stateLabel = new Label();       this.cityBox = new TextBox();       this.cityLabel = new Label();       this.streetTextBox = new TextBox();       this.streetLabel = new Label();       this.NoRadioButton = new RadioButton();       this.YesRadioButton = new RadioButton();       this.Over35Box = new CheckBox();       this.B1835Box = new CheckBox();       this.Under18Box = new CheckBox();       this.marriedLabel = new Label();       this.ageGroupLabel = new Label();       this.NewButton = new Button();       this.UpdateButton = new Button();       this.DeleteButton = new Button();       this.tabControl1.SuspendLayout();       this.tabPage1.SuspendLayout();       this.tabPage2.SuspendLayout();       this.tabPage3.SuspendLayout();       this.SuspendLayout();       //        // tabControl1       //        this.tabControl1.Controls.Add(this.tabPage1);       this.tabControl1.Controls.Add(this.tabPage2);       this.tabControl1.Controls.Add(this.tabPage3);       this.tabControl1.Location = new Point(0, 16);       this.tabControl1.Name = "tabControl1";       this.tabControl1.SelectedIndex = 0;       this.tabControl1.Size = new Size(312, 136);       this.tabControl1.TabIndex = 10;       //        // tabPage1       //        this.tabPage1.Controls.Add(this.lastNameTextBox);       this.tabPage1.Controls.Add(this.lastNameLabel);       this.tabPage1.Controls.Add(this.miTextBox);       this.tabPage1.Controls.Add(this.middleInitialLabel);       this.tabPage1.Controls.Add(this.firstNameTextBox);       this.tabPage1.Controls.Add(this.firstNameLabel);       this.tabPage1.Location = new Point(4, 22);       this.tabPage1.Name = "tabPage1";       this.tabPage1.Size = new Size(304, 110);       this.tabPage1.TabIndex = 0;       this.tabPage1.Text = "Basic";       //        // tabPage2       //        this.tabPage2.Controls.Add(this.zipCodeBox);       this.tabPage2.Controls.Add(this.stateBox);       this.tabPage2.Controls.Add(this.stateLabel);       this.tabPage2.Controls.Add(this.cityBox);       this.tabPage2.Controls.Add(this.cityLabel);       this.tabPage2.Controls.Add(this.streetTextBox);       this.tabPage2.Controls.Add(this.streetLabel);       this.tabPage2.Location = new Point(4, 22);       this.tabPage2.Name = "tabPage2";       this.tabPage2.Size = new Size(304, 110);       this.tabPage2.TabIndex = 1;       this.tabPage2.Text = "Address";       //        // tabPage3       //        this.tabPage3.Controls.Add(this.NoRadioButton);       this.tabPage3.Controls.Add(this.YesRadioButton);       this.tabPage3.Controls.Add(this.Over35Box);       this.tabPage3.Controls.Add(this.B1835Box);       this.tabPage3.Controls.Add(this.Under18Box);       this.tabPage3.Controls.Add(this.marriedLabel);       this.tabPage3.Controls.Add(this.ageGroupLabel);       this.tabPage3.Location = new Point(4, 22);       this.tabPage3.Name = "tabPage3";       this.tabPage3.Size = new Size(304, 110);       this.tabPage3.TabIndex = 2;       this.tabPage3.Text = "Other";       //        // formLabel       //        this.formLabel.Dock = DockStyle.Top;       this.formLabel.Font = new Font("Microsoft Sans Serif",                              8.25F, FontStyle.Bold, GraphicsUnit.Point, ((Byte)(0)));       this.formLabel.Location = new Point(0, 0);       this.formLabel.Name = "formLabel";       this.formLabel.Size = new Size(312, 16);       this.formLabel.TabIndex = 1;       this.formLabel.Text = "Customer Entry Form";       this.formLabel.TextAlign = ContentAlignment.TopCenter;       //        // lastNameTextBox       //        this.lastNameTextBox.Location = new Point(120, 72);       this.lastNameTextBox.Name = "lastNameTextBox";       this.lastNameTextBox.Size = new Size(176, 20);       this.lastNameTextBox.TabIndex = 4;       this.lastNameTextBox.Text = "";       //        // lastNameLabel       //        this.lastNameLabel.Location = new Point(8, 72);       this.lastNameLabel.Name = "lastNameLabel";       this.lastNameLabel.Size = new Size(104, 16);       this.lastNameLabel.TabIndex = 10;       this.lastNameLabel.Text = "Last Name";       //        // miTextBox       //        this.miTextBox.Location = new Point(120, 48);       this.miTextBox.MaxLength = 1;       this.miTextBox.Name = "miTextBox";       this.miTextBox.Size = new Size(16, 20);       this.miTextBox.TabIndex = 3;       this.miTextBox.Text = "";       //        // middleInitialLabel       //        this.middleInitialLabel.Location = new Point(8, 48);       this.middleInitialLabel.Name = "middleInitialLabel";       this.middleInitialLabel.Size = new Size(104, 16);       this.middleInitialLabel.TabIndex = 7;       this.middleInitialLabel.Text = "Middle Initial";       //        // firstNameTextBox       //        this.firstNameTextBox.Location = new Point(120, 24);       this.firstNameTextBox.Name = "firstNameTextBox";       this.firstNameTextBox.Size = new Size(176, 20);       this.firstNameTextBox.TabIndex = 2;       this.firstNameTextBox.Text = "";       //        // firstNameLabel       //        this.firstNameLabel.Location = new Point(8, 24);       this.firstNameLabel.Name = "firstNameLabel";       this.firstNameLabel.Size = new Size(104, 16);       this.firstNameLabel.TabIndex = 5;       this.firstNameLabel.Text = "First Name";       //        // zipCodeBox       //        this.zipCodeBox.Location = new Point(216, 69);       this.zipCodeBox.MaxLength = 5;       this.zipCodeBox.Name = "zipCodeBox";       this.zipCodeBox.Size = new Size(72, 20);       this.zipCodeBox.TabIndex = 9;       this.zipCodeBox.Text = "";       //        // stateBox       //        this.stateBox.Items.AddRange(new object[] {"PA","NJ","NY"});       this.stateBox.Location = new Point(120, 69);       this.stateBox.Name = "stateBox";       this.stateBox.Size = new Size(40, 21);       this.stateBox.TabIndex = 8;       //        // stateLabel       //        this.stateLabel.Location = new Point(8, 69);       this.stateLabel.Name = "stateLabel";       this.stateLabel.Size = new Size(104, 16);       this.stateLabel.TabIndex = 10;       this.stateLabel.Text = "State";       //        // cityBox       //        this.cityBox.Location = new Point(120, 43);       this.cityBox.MaxLength = 100;       this.cityBox.Name = "cityBox";       this.cityBox.Size = new Size(72, 20);       this.cityBox.TabIndex = 7;       this.cityBox.Text = "";       //        // cityLabel       //        this.cityLabel.Location = new Point(8, 43);       this.cityLabel.Name = "cityLabel";       this.cityLabel.Size = new Size(104, 16);       this.cityLabel.TabIndex = 9;       this.cityLabel.Text = "City";       //        // streetTextBox       //        this.streetTextBox.Location = new Point(120, 21);       this.streetTextBox.Name = "streetTextBox";       this.streetTextBox.Size = new Size(176, 20);       this.streetTextBox.TabIndex = 6;       this.streetTextBox.Text = "";       //        // streetLabel       //        this.streetLabel.Location = new Point(8, 21);       this.streetLabel.Name = "streetLabel";       this.streetLabel.Size = new Size(104, 16);       this.streetLabel.TabIndex = 8;       this.streetLabel.Text = "Street";       //        // NoRadioButton       //        this.NoRadioButton.Location = new Point(172, 55);       this.NoRadioButton.Name = "NoRadioButton";       this.NoRadioButton.Size = new Size(56, 24);       this.NoRadioButton.TabIndex = 15;       this.NoRadioButton.Text = "No";       //        // YesRadioButton       //        this.YesRadioButton.Location = new Point(100, 55);       this.YesRadioButton.Name = "YesRadioButton";       this.YesRadioButton.Size = new Size(56, 24);       this.YesRadioButton.TabIndex = 14;       this.YesRadioButton.Text = "Yes";       //        // Over35Box       //        this.Over35Box.Location = new Point(228, 31);       this.Over35Box.Name = "Over35Box";       this.Over35Box.Size = new Size(80, 24);       this.Over35Box.TabIndex = 13;       this.Over35Box.Text = "Over 35";       //        // B1835Box       //        this.B1835Box.Location = new Point(172, 31);       this.B1835Box.Name = "B1835Box";       this.B1835Box.Size = new Size(80, 24);       this.B1835Box.TabIndex = 12;       this.B1835Box.Text = "18 - 35";       //        // Under18Box       //        this.Under18Box.Location = new Point(100, 31);       this.Under18Box.Name = "Under18Box";       this.Under18Box.Size = new Size(80, 24);       this.Under18Box.TabIndex = 11;       this.Under18Box.Text = "Under 18";       //        // marriedLabel       //        this.marriedLabel.Location = new Point(8, 55);       this.marriedLabel.Name = "marriedLabel";       this.marriedLabel.Size = new Size(104, 16);       this.marriedLabel.TabIndex = 14;       this.marriedLabel.Text = "Married?";       //        // ageGroupLabel       //        this.ageGroupLabel.Location = new Point(8, 31);       this.ageGroupLabel.Name = "ageGroupLabel";       this.ageGroupLabel.Size = new Size(104, 16);       this.ageGroupLabel.TabIndex = 13;       this.ageGroupLabel.Text = "Age Group";       //        // NewButton       //        this.NewButton.Location = new Point(8, 160);       this.NewButton.Name = "NewButton";       this.NewButton.Size = new Size(96, 24);       this.NewButton.TabIndex = 2;       this.NewButton.Text = "New";       //        // UpdateButton       //        this.UpdateButton.Location = new Point(112, 160);       this.UpdateButton.Name = "UpdateButton";       this.UpdateButton.Size = new Size(96, 24);       this.UpdateButton.TabIndex = 3;       this.UpdateButton.Text = "Update";       //        // DeleteButton       //        this.DeleteButton.Location = new Point(216, 160);       this.DeleteButton.Name = "DeleteButton";       this.DeleteButton.Size = new Size(96, 24);       this.DeleteButton.TabIndex = 4;       this.DeleteButton.Text = "Delete";       //        // Form1       //        this.AutoScaleBaseSize = new Size(5, 13);       this.ClientSize = new Size(312, 189);       this.Controls.Add(this.DeleteButton);       this.Controls.Add(this.UpdateButton);       this.Controls.Add(this.NewButton);       this.Controls.Add(this.formLabel);       this.Controls.Add(this.tabControl1);       this.Name = "Form1";       this.Text = "Customer Entry Application";       this.tabControl1.ResumeLayout(false);       this.tabPage1.ResumeLayout(false);       this.tabPage2.ResumeLayout(false);       this.tabPage3.ResumeLayout(false);       this.ResumeLayout(false);     }     [STAThread]     static void Main()      {       Application.Run(new Form1());     }   }