Results 1 to 4 of 4

Thread: What is wrong with this code?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Location
    I'm right here!
    Posts
    849

    What is wrong with this code?

    hello,

    I have a combobox and a label.
    I don't know why this doesn't work:

    VB Code:
    1. Private Sub cmbChoice_Change()
    2. If cmbChoice.ListIndex = 0 Then
    3.     Label1.Visible = False
    4. Else
    5.     Label1.Visible = True
    6. End If
    7. End Sub

    what is the problem?

    thanks

    Dekel C.

  2. #2
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573
    Place the code in the click event handler. Change is triggered when you type to the combo.
    Lottery is a tax on people who are bad at maths
    If only mosquitoes sucked fat instead of blood...
    To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)

  3. #3
    Addicted Member
    Join Date
    Mar 2004
    Posts
    146
    I used to have the same problem. Now I use:

    VB Code:
    1. Private Sub Combo1_LostFocus()

  4. #4
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994
    Why would you use lostfocus and not the _click event? Assuming he wants to hide a label if some condition is true on click...
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

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