Hi,
I need code to be triggered by selecting a ComboBox entry with the mouse, or by typing the entry in.
When typing it in, the SelectedIndexChanged event gets triggered multiple times, which is a problem so I added a timer to bypass it.
I can't have MyCODE running more than once.
For some reason both SelectedIndexChanged and ComboBoxTimer_Tick are executing MyCODE.
Can anyone suggest a fix?
I need code to be triggered by selecting a ComboBox entry with the mouse, or by typing the entry in.
When typing it in, the SelectedIndexChanged event gets triggered multiple times, which is a problem so I added a timer to bypass it.
I can't have MyCODE running more than once.
For some reason both SelectedIndexChanged and ComboBoxTimer_Tick are executing MyCODE.
Can anyone suggest a fix?
Code:
Private Sub ComboBox_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles cboShape.KeyPress
Timer_ComboBox.Enabled = False
Timer_ComboBox.Enabled = True
End Sub
Private Sub ComboBoxTimer_Tick(ByVal sender As System.Object, ByVal e As EventArgs)
Timer_ComboBox.Enabled = False
Timer_ComboBox.Dispose()
MyCODE
End Sub
Private Sub cboShape_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles cboShape.SelectedIndexChanged
If Timer_ComboBox.Enabled = False Then
MyCODE
End If
End Sub