Subject: Combo Click event triggered unexpectedly
Posted By: ParadiseIsle Post Date: 12/9/2006 5:47:26 PM
In response to the user selecting an item from a dropdown list, a value is assigned to another dropdown list on the same form.  When this assignment is made, it triggers the "click" event for that other dropdown.  Why should this be?


Private Sub Step_Click()
        Select Case Step
        Case "New Diameter"
            Transition.Visible = True
            TransitionLabel.Visible = True
            Transition.Text = "Step"
        End Select
End Sub()

 
The line Transition.Text = "Step" triggers the Transition_Click() event, and in doing so, generates an unrelated error.


Reply By: marcostraf Reply Date: 12/11/2006 5:26:11 PM
this is how VB works: you change something in a control and automatically VB fires the related event for that control. The simple way to avoid this is to use a global boolean variable and set it before changing the property, reset it after. In the event of the other control, check if that variable is set, and if yes exits the sub right away

Marco

Go to topic 51996

Return to index page 96
Return to index page 95
Return to index page 94
Return to index page 93
Return to index page 92
Return to index page 91
Return to index page 90
Return to index page 89
Return to index page 88
Return to index page 87