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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Option Button

Status
Not open for further replies.

Gti

Programmer
Jul 23, 2001
99
PT
I have two Option Button. The first have a optionvalue=1 and the other a optionvalue=2. How i know when the first or the second button are true or valid?

Any help

Tkx

;-)
 
Do you have the options on a frame? If you do the value of the frame = the value of the option selected. Ie.
Code:
If MyFrame = 1 then
   Msgbox "You Selected Option 1"
End If

If MyFrame = 2 then
   Msgbox "You Selected Option 2"
End If

hth
Scoty ::) "Learn from others' mistakes. You could not live long enough to make them all yourself."
-- Hyman George Rickover (1900-86),
 
If they are part of an Option Group, you could return the value of the Option Group(it changes every time you select an option). If it is not you can loop through the form looking for the option button's value.

Private sub CheckOpBut()
Dim ctl as control
dim i as integer

for each ctl in me.controls
if typeof ctl is OptionButton then
if ctl.value = True

else

end if
end if
next


This routine needs to be fleshed out, but it should work.

Hope that helps.

 
Sorry, but i can't do it. I have the option buttons in a frame; How can i set the frame do work with de option buttons
 
I think what you have is a Box control with some Option Buttons on it. You'll need to delete the box and create an option group from your toolbox. The wizard will walk you through the process of creating the buttons. This option group will only allow one of the options to be selected at a time and the OptionGroup actually holds the value of the option button selected.

BB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top