我在vb.net处理事件
AddHandler ButtonOne.Click, AddressOf ButtonClick
Private Sub ButtonClick(ByVal ctrl As Office.CommandBarButton, ByRef Cancel As Boolean)
//do stuff
End sub
但是我的事件要求两次。当我点击按钮时,也会在另一种方法中点击 我正在处理同样的事件
Private Sub AddToolbar()
// do something
AddHandler firstButton.Click, AddressOf ButtonClick
End
如何解决此问题? 请帮助我
答案 0 :(得分:4)
正如汉斯指出的那样....你打电话给按钮点击两次......另见
AddHandler ButtonOne.Click, AddressOf ButtonClick 'You dont really need this if you add a handler to the sub see below...
Private Sub ButtonClick(ByVal ctrl As Office.CommandBarButton, ByRef Cancel As Boolean) Handles ButtonOne.Click
//do stuff
End sub