CheckBox and RichTextBox

Source: Internet
Author: User

namespacewindowsformsapplication1{ Public Partial classForm1:form { PublicForm1 () {InitializeComponent (); }        Private voidForm1_Load (Objectsender, EventArgs e) {            foreach(Control ctlinch  This. Controls)//traversing controls in a form            {                 if(CTL. GetType (). Name = ="CheckBox")//determines whether the type of control is a checkbox{checkbox cbox= (checkbox) CTL;//casting a traversed controlCbox. Autoellipsis =true;//set text too long display ...
//cbox. CheckAlign = ContentAlignment.MiddleCenter; do not dare to write this option, otherwise run the result as
Cbox. CheckAlign =Contentalignment.bottomright;Cbox. Checked=false; }            }        }        //Select basketball check box        Private voidCheckbox1_checkedchanged (Objectsender, EventArgs e) {            if(checkbox1.checked)//determine if CheckBox1 is selected            {                if(richTextBox1.Text = ="") richTextBox1.Text= Checkbox1.text;//assign a value to a text box                ElserichTextBox1.Text+=","+Checkbox1.text; }        }        //Select football check box        Private voidCheckbox2_checkedchanged (Objectsender, EventArgs e) {            if(checkbox2.checked)//determine if CheckBox2 is selected            {                if(richTextBox1.Text = ="") richTextBox1.Text= Checkbox2.text;//assign a value to a text box                ElserichTextBox1.Text+=","+Checkbox2.text; }         }        //Select the ping- pong ball check box        Private voidCheckbox3_checkedchanged (Objectsender, EventArgs e) {            if(checkbox3.checked)//determine if CheckBox3 is selected            {                if(richTextBox1.Text = ="") richTextBox1.Text= Checkbox3.text;//assign a value to a text box                ElserichTextBox1.Text+=","+Checkbox3.text; }        }    }}

CheckBox and RichTextBox

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.