1
我有follwing错误消息如何删除从控制集合创建的对象的事件
“AddressOf”操作数必须是一个方法的名称(没有括号)
尝试以下时代码:
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Dim xbutton As Control
For Each xbutton In gcFRightMenu.Controls
If xbutton.Name = commandbutton(0) Then
RemoveHandler xbutton.MouseDown, AddressOf xbutton.MouseDown
AddHandler xbutton.MouseDown, AddressOf _MouseDown
End If
Next
End Sub
Private Sub _MouseDown(ByVal sender As Object,
ByVal e As System.Windows.Forms.MouseEventArgs)
If e.Button = Windows.Forms.MouseButtons.Left Then SendKeys.Send("{ESC}")
End Sub
感谢之前删除它现在我明白了 – EvilacSon