Click to See Complete Forum and Search --> : Combo Box Click Event


Simonkale
August 13th, 2001, 07:40 PM
If I'm not wrong, combo box click event must only triggered when the user
clicks on the combo box. But something unsual is happening with my code.

combo box click:
Private Sub cboTrack_Click()
'do something here
End Sub

Private Sub Example()
cboTrack.Text = cboTrack.List(0) '<========= 'I have a breakpoint
here
End Example

Whenever the control is done with;
cboTrack.Text = cboTrack.List(0) '<========= 'I have a breakpoint
here
it goes to combo box click event. But i haven't called it and have no
intension of doing it either.
Is there a way to stop VB to go to combo box click event ofcourse without
deleting the event itself?

Thanks,
Simon

d.paulson
August 13th, 2001, 09:56 PM
That happens when the combo style is set to drop down list. You may need to put in a flag in the click event to process the following code or skip it.


option explicit
dim skipcombo as boolean

private sub cboTrack_click()
if skipcombo = true then 'skip the click event
exit sub
end if
'process this event if skipcombo = false
do something ...
do something else ...
end sub


Private Sub Example()
skipcombo = true
cboTrack.Text = cboTrack.List(0) '<========= 'I have a breakpoint
here
skipcombo = false
End sub




David Paulson