Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

‘Tri-state’ control 1

Status
Not open for further replies.

Andrzejek

Programmer
Jan 10, 2006
8,555
US
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: [pre]
Railroad Involved: O Yes O No[/pre]
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:[pre]
Railroad Involved: O Yes O No O Undecided [/pre]
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:[pre]
Undecided (default)
Yes
No[/pre]
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.
 
WOW! That was simple.
I don’t venture into VB.NET world often (stuck in VB6 :-( ) 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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top