Results 1 to 6 of 6

Thread: Help with combo box

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2004
    Posts
    7

    Help with combo box

    I have this code so if I select something from the combo box, there is a text box next to it, which will show the explanation of the selection, can someone take a look at this and see if there is a way to make this happen:

    VB code:
    Private Sub cbSLAType_Change()
    If cbSLAType = "PC Replacement" Then
    txtTypeDetail.Visible = True
    txtTypeDetail.Text = "PC Replacement"
    ElseIf cbSLAType = "Password Reset" Then
    txtTypeDetail.Visible = True
    txtTypeDetail.Text = "Password Reset"
    ElseIf cbSLAType = "3D ID set up" Then
    txtTypeDetail.Visible = True
    txtTypeDetail.Text = "3D Id Set Up"
    ElseIf cbSLADetail = "Phone Moves" Then
    txtTypeDetail.Visible = True
    txtTypeDetail.Text = "Phone Moves"
    ElseIf cbSLAType = "Workstation Moves" Then
    txtTypeDetail.Visible = True
    txtTypeDetail.Text = "Workstation Moves"
    ElseIf cbSLAType = "LAN Printer Moves" Then
    txtTypeDetail.Visible = True
    txtTypeDetail.Text = "LAN Printer Moves"
    Else
    txtTypeDetail.Visible = False
    End If

    End Sub

    maybe there is a better way to do this, the text box is going to be invisible, but when they make the selection, it'l show the explanation.

    Thank you for your help.

  2. #2
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246
    Does it show the explanation when you CLICK it? Or when you move the mouse over it?



    Phreak

    Visual Studio 6, Visual Studio.NET 2005, MASM

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2004
    Posts
    7
    when you click it

  4. #4
    PowerPoster Keithuk's Avatar
    Join Date
    Jan 2004
    Location
    Staffordshire, England
    Posts
    2,236
    You need to put this code in the Private Sub cbSLAType_Click(), Click event, not Change event. You would think logically that it goes in the Change event because the text is changing. But VB doesn't think that logically. I just changed it to the Click event and it works fine.


  5. #5

    Thread Starter
    New Member
    Join Date
    Mar 2004
    Posts
    7
    Yes it worked, Thank you

  6. #6

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