C#winform RadioButton Use Tips

Source: Internet
Author: User

C # WinForm in the same group of multiple RadioButton use techniques, because the use of, summary classification, make a record

You can define a method to handle the group RadioButton, as follows:

public void Allradio_checkedchanged (object sender, EventArgs e)
        {
            if (!) ( (RadioButton) sender). Checked)
            {return
                ;
            }
            String stext = String. Empty;
            Switch ((RadioButton) sender). Name
            {case
                "Shradio":
                    stext = "query data";
                    Panel5. Visible = true;
                    Panel6. Visible = false;
                    break;
                Case "Mdradio":
                    stext = "Modify data";
                    Panel6. Visible = true;
                    Panel5. Visible = false;
                    break;
                Case "Delradio":
                    stext = "delete data";
                    Panel5. Visible = true;
                    Panel6. Visible = false;
                    break;
            Groupbox3.text = stext;
            Button1. Text = stext;
            Ismodify (true);
        

When the definition is complete, the checkchanged time of the RadioButton involved will be selected to match the different RadioButton values according to the button selection
Related Article

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.