Results 1 to 9 of 9

Thread: easy one Again!

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2001
    Posts
    843

    Talking easy one Again!

    I hate this! In a combo box... I havent found the correct event for when you change the selected item.

    Onchange will only be executed if you type.
    Onlostfocus... will only be executed, of course, when the focus has been lost.

    But I have seen programs that react to the action of just selecting another item from the list.

    Thank you!

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Use the Click event!

    Best regards

  3. #3
    Megatron
    Guest
    I believe it's the Click() event.

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2001
    Posts
    843

    Unhappy

    No! I am sorry!

    But the clic event is not executed when you select a different item. It is fired right when you clic the control...

  5. #5
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Are you talking about the standard combo box that comes with VB?
    The Click event in that one is only fired when you select a new item in the list.

  6. #6
    Megatron
    Guest
    It should work. Add this to a Form with a ComboBox.
    Code:
    Private Sub Combo1_Click()
        MsgBox "You select: " & Combo1.Text
    End Sub
    
    Private Sub Form_Load()
        
        For i = 0 To 10
            Combo1.AddItem "Item" & i
        Next i
        
    End Sub

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2001
    Posts
    843

    Talking OOOOOOOOPSSSSSSSSSSSS!!!!!!!!!!

    You are right.......................

  8. #8
    Matthew Gates
    Guest
    You should use both the Change() and Click() events.

    Just using the example above.

    Code:
    Private Sub Combo1_Change()
        Call Combo1_Click
    End Sub
    
    Private Sub Combo1_Click()
        MsgBox "You select: " & Combo1.Text
    End Sub
    
    Private Sub Form_Load()
        
        For i = 0 To 10
            Combo1.AddItem "Item" & i
        Next i
        
    End Sub

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2001
    Posts
    843
    OK!

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