Button,checkbox,lable,radiobutton,combobox,textbox use of six simple controls

Source: Internet
Author: User

All text changes are all changed in the Text property!

ComboBox: Click the small arrow at the top right to select the Edit item popup:

  

The Radiobutton:,checked property selects true to indicate that it has been selected;

Button: In the design, double-click the buttons to jump to the code area, the code will add the following code:

usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;namespace_6 A simple control _ KFC order Meal { Public Partial classForm1:form { PublicForm1 () {InitializeComponent (); //Staple Food Index defaults to 0Combobox1.selectedindex =0; }        Private voidForm1_Load (Objectsender, EventArgs e) {        }        Private voidRadiobutton1_checkedchanged (Objectsender, EventArgs e) {        }        Private voidRadiobutton3_checkedchanged (Objectsender, EventArgs e) {        }        Private voidButton1_Click (Objectsender, EventArgs e) {            //Select Staple            stringZS =comboBox1.SelectedItem.ToString (); //Choose a dish            stringPc=""; if(radiobutton1.checked)//the fries are selected.PC ="French Fries"; Else if(radiobutton2.checked)//the potatoes are selected.Pc="Potato Puree"; Else//The corn sticks are selected.PC ="Corn Sticks"; //Choose a Drink            stringYP =""; if(checkbox1.checked)//check Coke .{YP+=Checkbox1.text; if(checkbox2.checked)//check Coke, coffee{YP=yp +","+Checkbox2.text; if(checkbox3.checked)//check Coke, coffee, orange juice.{YP=yp+","+Checkbox3.text; }                }                if(checkbox3.checked)//check Coke, orange juice.{YP= YP +","+Checkbox3.text; }            }            Else if(checkbox2.checked)//Select Coffee{YP+=Checkbox2.text; if(checkbox3.checked)//Select Coffee, orange juice{YP=yp+","+Checkbox3.text; }            }            Else//only orange juice is selected .{YP+=Checkbox3.text; }            //Get Address            stringDZ =TextBox1.Text; //Get the phone            stringDH =TextBox2.Text; //pop-up message boxMessageBox.Show ("The staple you choose is:"+zs+"\ n The matching dish is:"+pc+"\ n drinks are:"+yp+"\ n Shipping Address:"+dz+"\ n Contact information:"+DH); }    }}

Click on the Order popup:

Button,checkbox,lable,radiobutton,combobox,textbox use of six simple controls

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.