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

Option Buttons in the same form

Status
Not open for further replies.

carlosweiss

Programmer
Sep 15, 2005
15
AR
Hi,

Is there any possibility to have different groups of option buttons within the same form? That is, several questions each with a Yes/No possible answer. I have a form with a lot of such questions (more than 20) and after I designed the form layout and put all the controls in there I realized that each group of option buttons (each question in my case) must be within a separate frame. That would be impossible for me to do it that way.

Thanks,

Carlos
 
>That would be impossible for me to do it that way.

I'm guessing that screen real estate is a problem. The extra space required for a frame would cause your controls to 'no fit' on the screen.

You have a couple of options to resolve this problem.

You could add an ssTab control and then group your yes/no questions on various tabs. This is not very appealing because you probably want all the information displayed on the screen at the same time.

Alternatively, you could try using the combo box control. Set the style to Drop Down List and hard code 3 items in each list. The first item could be something like <unknown>, the second item could be yes and the third item could be no. Often times, this will take less space than option buttons.



-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
you could also use checkboxes,they check it if its yes and leave it if its no that way you need half the number :)
 
or you could set the caption property of the frame to "" and the BorderStyle to None, then it's like they were never there except that the option buttons work as expected now.


Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'.
 
Hi Guys:

WARNING: Cassie's rambling again.

Since there are multiple yes-no questions, each requiring an option button pair, why not create a simple ActiveX control (OCX)?

Here is what I would suggest:
UserControl with two option buttons:
optYes
optNo

The code is kept simple:
Code:
    Option Explicit


    Private m_blnYes As Boolean
    Private m_blnClicked As Boolean


    Private Sub optYes_Click()
        m_blnYes = True
        m_blnClicked = True
    End Sub


    Private Sub optNo_Click()
        m_blnYes = False
        m_blnClicked = True
    End Sub


    Property Let Yes(ByVal blnYes As Boolean)
        m_blnYes = blnYes
        optYes.Value = blnYes
        optNo.Value = Not blnYes
        m_blnClicked = False
    End Property


    Property Get Yes() As Boolean
        Yes = m_blnYes
    End Property


    Property Get Clicked() As Boolean
        Clicked = m_blnClicked
    End Property


    Public Sub YesNo_Initialize()
        m_blnYes = False
        m_blnClicked = False
        optYes.Value = False
        optNo.Value = False
    End Sub

Opinions?

Cassie

Cassie
PIII-500Mhz-128MB
Win98SE-VB6SP5
 
Thanks everyobody for your suggestions, I finally did it the "craftsman" way. I put a frame beneath each of the 24 questions (I can always change the frame size so that it's the same as that of the question). That wasn't so terrible...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top