>I guess i didn't ask my question clearly. I want to disable and enable the button in my code before the form is run. Depending on which program runs, the button will be enable or disabled.
>
>I don't know how to refer to the button in the object. When I modify the form and the buttons I see "optionsgroup1" then the buttons as "option1" , "option2" etc. This is what I don't know how to refer to in code.
Randall,
Add a parameter statement to the form's Init event. When your program runs the form pass a vlaue to that parameter with DO FORM Whatever WITH "SomeValue". IN the Form's Init event use a DO CASE to check the value of the parameter and set the enabled property for the buttons.
For an optiongroup you would do something like this;
* Form Init
LPARAMETERS pcWhichButtons
WITH Thisform.OptionGroup1
DO CASE
CASE pcWhichButtons = "EVEN"
.Option1.Enabled = .F.
.Option2.Enabled = .T.
.Option3.Enabled = .F.
.Option4.Enabled = .T.
CASE pcWhichButtons = "ODD"
.Option1.Enabled = .T.
.Option2.Enabled = .F.
.Option3.Enabled = .T.
.Option4.Enabled = .F.
ENDCASE
ENDWITH
You cannot do this BEFORE you run the form because the form and the buttons don't exist UNTIL you run the form.