Click to See Complete Forum and Search --> : Easy Visual Basic Question....


DVader
March 29th, 2001, 02:41 PM
How do I set an option button so it is automatically selected and is the default button when a form loads?
It is located in a group of 6 other option buttons in a frame.

CJK
March 29th, 2001, 03:05 PM
You set the tabindex property of the button to 0 and consecutively after that. Hope that helps.

LagMonster
March 29th, 2001, 03:07 PM
if the option where named "option"

If I were in front of a compiler I could tell you FOR SURE.

on the load sub

sub form_load
option(N).selected=true
end sub
where N is the index in the array.

I'll post back the right answer if I am wrong.

furlong47
March 29th, 2001, 07:32 PM
Private Sub Form_Load()
optButton.Value = True
End Sub

where optButton is the name of the button you want selected

CJK's suggestion also works

LagMonster
March 30th, 2001, 06:19 AM
Yeah those two are right...don't use my suggestion for selected isn't even a value in an option. I suck. :p

Imon Fyre
March 30th, 2001, 09:56 AM
that sounds right.. boy its been a while since ive had to call forth the VB code from the recesses of high skool programming(in fact, it was just last year!!)