Results 1 to 8 of 8

Thread: [RESOLVED] Combobox/optionbutton

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Location
    Holland ook wel Nederland
    Posts
    151

    Resolved [RESOLVED] Combobox/optionbutton

    Hey guys,

    I want an combox that's enabled when you hit the optionbutton next to it, does anyone know a code for that? Thanks :-)

  2. #2
    Hyperactive Member
    Join Date
    Feb 2006
    Location
    Philippines
    Posts
    468

    Re: Combobox/optionbutton

    Quote Originally Posted by Ermen
    Hey guys,

    I want an combox that's enabled when you hit the optionbutton next to it, does anyone know a code for that? Thanks :-)
    use the click event of the optionbutton to enable the combobox next to it

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Location
    Holland ook wel Nederland
    Posts
    151

    Re: Combobox/optionbutton

    I don't know how that's the problem :$

  4. #4
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: Combobox/optionbutton

    you need a Checkbox for that purpose because if you have only one option button then you cannot disable the combo again. try this:
    VB Code:
    1. Private Sub Form_Load()
    2.     Combo1.Enabled = False
    3. End Sub
    4.  
    5. Private Sub Check1_Click()
    6.     If Check1.Value Then
    7.         Combo1.Enabled = True
    8.     Else
    9.         Combo1.Enabled = False
    10.     End If
    11. End Sub
    if you still want to use an option button, and you only have Option button and the combobox on your form, then put the option button within another container like PictureBox or Frame and in the above mentioned code, replace Check with Option.

    Harsh Gupta.
    Show Appreciation. Rate Posts.

  5. #5
    Hyperactive Member
    Join Date
    Jan 2006
    Posts
    269

    Re: Combobox/optionbutton

    Private Sub Option1_Click()
    Combo1.Enabled = True
    End Sub

    Also you would need to disable it if the user presses another optbutton

    Private Sub Option2_Click()
    Combo1.Enabled = False
    End Sub

  6. #6
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: Combobox/optionbutton

    Harsh
    Can't your code be simplifed to the following?
    VB Code:
    1. Private Sub Check1_Click()
    2.     Combo1.Enabled = Check1.Value
    3. End Sub
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Location
    Holland ook wel Nederland
    Posts
    151

    Re: Combobox/optionbutton

    Thanks, the last post works..

  8. #8
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: Combobox/optionbutton

    Quote Originally Posted by DKenny
    Harsh
    Can't your code be simplifed to the following?
    VB Code:
    1. Private Sub Check1_Click()
    2.     Combo1.Enabled = Check1.Value
    3. End Sub
    :slaps forhead: knew doing something extra.

    thank you
    Show Appreciation. Rate Posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width