INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

‘Tri-state’ control

‘Tri-state’ control

(OP)
Sometimes I have a situation where user has to make a decision. The ‘state’ of that decision starts as ‘Undecided’ (default as NULL in the data base), and the user has to decide either ‘Yes’ or ‘No’ (so the field gets the value of ‘Y’ or ‘N’). So for example the decision is: Railroad Involved

So far (in VB6) we have 2 options with none selected:
    Railroad Involved:   O Yes   O No 
And once user selects any of the options, there is no way to get back to ‘undecided’, and that’s OK. I am not crazy about this approach because – in my option – when using option buttons, one of them should be selected as default. So if it was up to me, it would be:
    Railroad Involved:   O Yes   O No   O Undecided  
With the last option (Undecided) selected by default. And when either Yes or No selected, last option would be grayed out and not available any more. But that takes more space on the Form.

If I would have a No (or a Yes) as a default, I would then use a check box, but that’s not the case.

In VB.NET when you place any radio buttons, VB.NET selects one of them ‘by default’ (and I can understand why, see my opinion above) so if I would recreate what I have in VB6 with no radio button selected, I would have to do a lot of coding to make all of radio buttons be ‘not selected’ and that would go against default settings. A lot of headache, right? (Or am I wrong here?).

I could go with a combo box with:
    Undecided (default)
    Yes
    No 
And when either Yes or No chosen, ‘Undecided’ goes away.

Is there any other control / approach in VB.NET that would give me this ‘tri-state’ capabilities?

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.

RE: ‘Tri-state’ control

A Checkbox with an initial CheckState of Indeterminate?

RE: ‘Tri-state’ control

(OP)
WOW! That was simple.
I don’t venture into VB.NET world often (stuck in VB6 sad ) but that looks exactly what I was looking for. And it works by design the way I want it to.

Thank Dave.

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close