Results 1 to 7 of 7

Thread: Making textbox and combobox visible

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Posts
    5

    Post

    I need to have a textbox and a combobox to be invisible to start but if someone clicks on the Optionbutton "Yes" to have them the textbox and combobox to be visible. I have tried several variations of the code below but none seem to work. Any help me?

    Private Sub Upgrade_Click()
    If Upgrade(1).Value = 1 Then
    UpgradeDate.Visible = True
    UpgradeDateLabel.Visible = True
    UpgradeTo.Visible = True
    UpgradeToLabel.Visible = True
    End If
    End Sub

    Thanks.


    ------------------
    Stanley

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    Upgrade(1) looks like it's an array but
    Private Sub Upgrade_Click() doesn't

    maybe you're putting the code in the wrong place!

    ------------------
    Mark Sreeves
    Analyst Programmer

    [email protected]
    A BMW Group Company

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Posts
    5

    Post

    Ok ignoring my code above do you know of anyway to do what I am trying to do?

    ------------------
    Stanley

  4. #4
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Ok, lets start from the beginning. You have an empty form. When you add an Option button to the form, the name of this Option button would be Option1 (by default) and when you add command button it would be Command1 (by default). Same with Textbox - it would be Text1. So, lets assume that you have added those controls to your form (Option1, Option2 (this one is to hide controls again) Command1, Text1)

    Code:
    Private Sub Form_Load()
        Option1.Caption = "&Show controls"
        Option2.Caption = "&Hide controls"
        Option1.Value = True
    End Sub
    
    
    Private Sub Option1_Click()
        Command1.Visible = True
        Text1.Visible = True
    End Sub
    
    
    Private Sub Option2_Click()
        Command1.Visible = False
        Text1.Visible = False
    End Sub

    Note: Of course, you better create a Control Array (for Option button).


    Regards,

    ------------------

    Serge

    Software Developer
    [email protected]
    [email protected]
    ICQ#: 51055819


  5. #5
    Hyperactive Member
    Join Date
    Jan 1999
    Location
    Rotterdam, Netherlands
    Posts
    386

    Post

    textbox.visible = optionbutton.value
    combobox.visible = textbox.visible

    put this in the click event of the optionbutton

  6. #6
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Crazy D's code will work only if you have more then 1 option button. Because, if you have only one, then you woun't be able to change the option value back to FALSE.

    Regards,

    ------------------

    Serge

    Software Developer
    [email protected]
    [email protected]
    ICQ#: 51055819


  7. #7
    New Member
    Join Date
    Nov 1999
    Posts
    2

    Post

    Did you try:

    OptionButton_Click()

    if OptionButton.Value = True then
    combobox.visible = true
    textbox.visible = true
    endif

    end sub

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