RadioButton ReadOnly

Posted on 2009-02-16
Last Modified: 2013-12-17
I can set my textboxes to ReadOnly is it possible to set a property in a radiobutton list to be read only
Question by:Mr_Shaw
    LVL 4

    Assisted Solution

    Look at the "Enabled" property.  You can also set the Enabled property on a Panel that the radio buttons are contained in.

    Author Comment

    I have used enabled, but it greys out the buttons... this is not good for the those who can't see so well.

    With my textboxes I changed them from enabeled= false to readonly = true and I retained the correct font color..

    LVL 69

    Assisted Solution

    by:Éric Moreau
    LVL 74

    Accepted Solution

    I have attached some code which should simulate what you are trying to achieve--it is not merely a property, but should be adequate:

    You would need to change how you set the R/O flag--here I'm just using a button to set/unset the flag. I made 3 radio buttons on my form and set all of their CheckChanged handlers to the function radioButton3_CheckChanged. This is the reason I casted the buttons within that function.
    private bool READONLY;
    private RadioButton RADIOBUTTON;
    public Form1()
        this.READONLY = false;
    private void radioButton3_CheckedChanged(object sender, EventArgs e)
        if (((RadioButton)sender).Checked)
            this.RADIOBUTTON = (RadioButton)sender;
        if (this.READONLY)
            this.RADIOBUTTON.Checked = true;
    private void button1_Click(object sender, EventArgs e)
        this.READONLY = !this.READONLY;
        this.label1.Text = this.READONLY.ToString();

    Open in new window


    Author Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    In my previous article ( we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
    Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now