General discussion

Locked

VB: Options Buttons & a Default Value

By lgreenbe ·
How do I create a group of option buttons (radio buttons) and prevent them from appearing which one option already selected?(e.g. a default selection)

When I set all the value properties to false, the first option button shows up as selected.

This conversation is currently closed to new comments.

11 total posts (Page 1 of 2)   01 | 02   Next
| Thread display: Collapse - | Expand +

All Comments

Collapse -

VB: Options Buttons & a Default Value

by tclere In reply to VB: Options Buttons & a ...

Make sure that you do not use the SetFocus method, which will activate the option. Try it on a blank form, setting all of the value properties to false will deactivate all selections. You may have some other code that is causing this to happen.

Collapse -

VB: Options Buttons & a Default Value

by lgreenbe In reply to VB: Options Buttons & a ...

Poster rated this answer

Collapse -

VB: Options Buttons & a Default Value

by Ramesh Vishnubhatla In reply to VB: Options Buttons & a ...

Usually Option buttons are used when the answers to a question is from a pre-defined list. So, one of them has to be selected. If you want to handle a situation when none of the options is valid, then you may try these two things:
<br><ul>
<li>Have another option button with a caption "No Selection" or something like that.</li>
<li>Have a Check box, which when checked will enable a frame containing the option buttons and when unchecked diables the frame. In the code, you can check for thevalue of the Check box before proceeding to evaluate the value of an option button.</li>
</ul>
<br>
Hope this answer helps.

Collapse -

VB: Options Buttons & a Default Value

by lgreenbe In reply to VB: Options Buttons & a ...

Poster rated this answer

Collapse -

VB: Options Buttons & a Default Value

by trishs In reply to VB: Options Buttons & a ...

It could be that the option group is the first item in the TabIndex - when the form loads, it receives the focus and the first option gets selected. Set the TabIndex of something else to 0, and you should have no problems.

Collapse -

VB: Options Buttons & a Default Value

by lgreenbe In reply to VB: Options Buttons & a ...

Poster rated this answer

Collapse -

VB: Options Buttons & a Default Value

by donq In reply to VB: Options Buttons & a ...

If your Option Group is linked with a Field within a Table make sure its Default Value is Null, When you create an Option Group you are allowed to create one where one of yout pre-defined values is used as a "Default", or select the No Nefault Option which should open the entire group (for a new record) whit every button greyyed. When the Form indexes to a selected record (where an attached field is linked to the group) the selected option should change from record to record. When I use the Wizard to create the Group (and mess up) I just delete it and start over - it only takes a minute?

Collapse -

VB: Options Buttons & a Default Value

by lgreenbe In reply to VB: Options Buttons & a ...

Poster rated this answer

Collapse -

VB: Options Buttons & a Default Value

by kellyl In reply to VB: Options Buttons & a ...

Create an extra option button and set its value to True. Then using the properties page "move" this button to where it is not visiable in the group box. You may then check its value in code to see if the user has selected an option.

Collapse -

VB: Options Buttons & a Default Value

by lgreenbe In reply to VB: Options Buttons & a ...

Poster rated this answer

Back to Web Development Forum
11 total posts (Page 1 of 2)   01 | 02   Next

Related Discussions

Related Forums