Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a CheckBox unselectable?

Tags:

c#

winforms

I was wondering how you make a CheckBox unselectable in c#? I thought it would be something like SetSelectable (false) or something but I can't seem to see the method.

I found CanSelect but this seems to be a read only property.

like image 203
rik Avatar asked May 11 '11 08:05

rik


People also ask

How do I make a non clickable checkbox?

Practically speaking, this is the solution that many of us are looking for. How to make the checkbox un-changeable (answer: disable it) but still preserve the value of whether it is checked or not upon save (answer: use a hidden input type). Make sure to only add the hidden input if you have also disabled the checkbox.

How do I GREY out a checkbox?

You can style checkbox label and readonly inputs with CSS, e.g.: input [readonly="readonly"] {} but the browser should make the checkbox should appear greyed out when set to readonly. "checkbox itself should appear greyed out just by setting the readonly attribute" - Tried in IE8, FF12. 0, Chrome. Only works in Chrome.

Can a checkbox be readonly?

If the checkbox is readonly, it won't change. If it's not, it will. It does use jquery, but you're probably using that already... It works.


2 Answers

You can set AutoCheck property to false.

like image 129
Jacob Seleznev Avatar answered Oct 12 '22 04:10

Jacob Seleznev


You can set the Enabled property to false:

checkBox1.Enabled = false; 
like image 34
anothershrubery Avatar answered Oct 12 '22 06:10

anothershrubery