Combobox control, change event 
Author Message
 Combobox control, change event

Hi there,

I'm a newbie here, please bear with me for a sec and at least point me
in the right direction.  I am using VB4.0 and have a ComboBox control.  I
need some action to take place when the user changes the selection (with
mouse or keys) but don't know which event to use.  I tried
using the _change() event, with no luck, it didn't get called.
Is there something I have to do to make it work?  Or what's the
correct event to use?

Thanlks,

- Roberto

--




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



Sun, 02 Jul 2000 03:00:00 GMT  
 Combobox control, change event

Use Click event ---

Regards, Davie

Quote:

> Hi there,

> I'm a newbie here, please bear with me for a sec and at least point me
> in the right direction.  I am using VB4.0 and have a ComboBox control.  I
> need some action to take place when the user changes the selection (with
> mouse or keys) but don't know which event to use.  I tried
> using the _change() event, with no luck, it didn't get called.
> Is there something I have to do to make it work?  Or what's the
> correct event to use?

> Thanlks,

> - Roberto

> --




> ----------------------------------------------------------------------------



Sun, 02 Jul 2000 03:00:00 GMT  
 Combobox control, change event

Use the Click Event and check the combo's ListIndex value to tell what was
Selected.

If you need to be able to tell if the value changed you should use a form
level variable to track the value of the ListIndex.

Option Explicit
Private lngLastSelected As Long

Private Sub Form_OnLoad()
        lngLastSelected = -1 'Nothing selected yet
End Sub

Private Sub cboMyCombo_Click()
        If lngLastSelected <> cboMyCombo.ListIndex Then   ' selection changed
                ' Do something
                lngLastSelected = cboMyCombo.ListIndex 'update the last selection
        End If
End Sub



Quote:

> Hi there,

> I'm a newbie here, please bear with me for a sec and at least point me
> in the right direction.  I am using VB4.0 and have a ComboBox control.  I
> need some action to take place when the user changes the selection (with
> mouse or keys) but don't know which event to use.  I tried
> using the _change() event, with no luck, it didn't get called.
> Is there something I have to do to make it work?  Or what's the
> correct event to use?

> Thanlks,

> - Roberto

> --



> Tufts University        __/__,           uucp:


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

- Show quoted text -



Mon, 03 Jul 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. ComboBox Change Event Does not fire when user changes selection

2. commandbar combobox and its change event

3. commandbar combobox and its change event

4. Help: Losing ComboBox Change event in UserControl OCX

5. Change event (combobox)

6. ComboBox Change Event

7. ComboBox Change event

8. ComboBox Change event

9. Combobox List Change Event

10. combobox style2 change event

11. Speaking of Combobox Change Events...

12. Combobox.clear doesn't generate Change event

 

 
Powered by phpBB® Forum Software