Check Box Greyed

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In VB6, you could set a check box to checked, unchecked, or greyed. The
latter would be used to show a setting but disable the control.

In .Net, the third choice is not greyed, but indeterminate. And the doc
says it shows it as greyed, but checked. So how do you show greyed and
unchecked?

Disabling the control in total greys out the control's text which is less
than desirable.
 
Ed,

To grey it out, mark Enabled as False.
To check/uncheck, change Checked as needed. Unchecked is False.

Good luck,
Matt
 
EdB said:
In VB6, you could set a check box to checked, unchecked, or greyed. The
latter would be used to show a setting but disable the control.

In .Net, the third choice is not greyed, but indeterminate. And the doc
says it shows it as greyed, but checked. So how do you show greyed and
unchecked?

Set the control's 'TreeState' property to 'True'.
 
Matt said:
To grey it out, mark Enabled as False.
To check/uncheck, change Checked as needed. Unchecked is False.

The OP wrote that disabling is not an option:

| Disabling the control in total greys out the control's text which is less
| than desirable
 
As I stated below......if I follow this approach, the text next to the check
box will be "disabled" as well. That is not the answer I am looking for.
 
OK, I gathered that that had something to do with it, but I am still not clear.

Can you give me a quick code example that shows the checkbox as checked,
then unchecked with the user locked out from manipulating it?
 
EdB said:
Can you give me a quick code example that shows the checkbox as checked,
then unchecked with the user locked out from manipulating it?

It seems that I misunderstood your post too. You can archieve the desired
behavior by setting the checkbox' 'AutoCheck' property to 'False'.
 
:
setting the checkbox' 'AutoCheck' property to 'False'.

We're getting closer I think, but this is still not the behavior I am truly
after.

I have a business object. The user pulls the record up for editing. A
particular bit field may be viewed but not edited.

Auto check will prevent them from changing the state of the control, but the
fact that box itself is not greyed is not intuitive to the user......they
will wonder why they are clicking in the box and nothing is happening.

As I said, in VB6 you could grey the checkbox and have the text associated
with the checkbox displayed normally. That's what I'm after.
 
I would use two controls, a checkbox with no text and a label beside it with
the text. You can then enable/disable the checkbox to grey it out and the
label won't be greyed!
 
Back
Top