O
One Handed Man
Cut the four lines out, and rebuild it.
Regards - OHM
Regards - OHM
Hi,
does anybody know how to suppress an event?
I have a combo box with the following code?
Private Sub cmb_GotFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles cmb.GotFocus
cmb.DroppedDown = True
End Sub
When the user clicks on the combobox (because this piece of code) it
closes. So I would like to supress this event when the click and dropdown
event fires.
Any Clue?
Regards,
Marco Roberto
Tom said:You either use a flag... Something like
Private Sub cmb_GotFocus......
Static Done As Boolean
If Not Done Then
' Do your stuff
Done = True
End If
End Sub
Or you loose the handles clause and add the event dynamically and
remove it once processed.
Public Sub Form_Load....
....
AddHandler cmb.GotFocus, AddressOf Me.cmb_GotFocus
End Sub
Private Sub cmb_GotFocus
' Do your stuff
RemoveHandler cmb.GotFocus, AddressOf Me.cmb_GotFocus
End Sub
Then the even will never fire again.
One Handed Man said:Well, rather than trying to supress the even, why not supress the action.
Set a class level variable while you are performing whatever it is you are
doing and clear it afterwards. Then the the event in question test that
variable.
OHM