tags:

views:

68

answers:

3

Hey all, The problem like this, I have a groupBox which contains two radio buttons, when I run the form, the first radio button get checked immediately, so I tried the following:

  • Set the check property for this radio button to false in Load form.
  • Set the check property for this radio button to false in the form constructor.
  • Change the tab index property for this radio button, the selection moved to the next radio button in the form.

None of the above worked with me, any suggestions??

+1  A: 

As soon as any of the radio buttons get focus it'll be selected, so you need to set initial focus in the form to another control than any of those radio buttons (worst case I suppose you could have a hidden radio button or other control and give that focus, but I'd not recommend it since it looks funny).

ho1
What do you mean by "initial focus"? you mean the tabIndex smallest value in the whole form?
Shaza
@shaza: Yes (assuming no other property will stop it from receiving focus).
ho1
OK, thanks as well I edited that and the problem was solved.
Shaza
+1  A: 

You could try setting it to false in the form SHOWN event instead of the form LOAD event as outlined in this question.

msergeant
That worked perfectly, thanks a lot. :)
Shaza
A: 

The intent of a radio button set is to provide choice between a set of distinctive and exhaustive values. That means, that at all times, one and only one radio button should be selected.

If this functionality does not suite your application logic, maybe the logic is flawed, or maybe radio-buttons are not the best UI solution.

As mentioned, a radio button group displays its behavior as soon as any of the radios get focus, which can happen even with just tabbing around the form, so basically the behaviour of the form depends on the user behaving nicely.

SWeko