Vb.net AddHandler是否需要参数?

Vb.net AddHandler是否需要参数?,vb.net,addhandler,Vb.net,Addhandler,我试图添加一个处理程序,但一旦我针对一个有参数的方法,处理程序就会失败。以下是简单的代码: AddHandler App.Current.RootVisual.MouseLeftButtonUp, RootVisual_MouseLeftButtonUp Private Sub RootVisual_MouseLeftButtonUp(ByVal sender As Object, ByVal e As MouseButtonEventArgs) End Sub 此错误不允许我生成。当看这

我试图添加一个处理程序,但一旦我针对一个有参数的方法,处理程序就会失败。以下是简单的代码:

AddHandler App.Current.RootVisual.MouseLeftButtonUp, RootVisual_MouseLeftButtonUp

Private Sub RootVisual_MouseLeftButtonUp(ByVal sender As Object, ByVal e As MouseButtonEventArgs)

End Sub
此错误不允许我生成。当看这些例子时,我做得很好。这是我得到的错误:

错误3未为“Private Sub”的参数“e”指定参数 RootVisual_MouseLeftButtonUp(发送者作为对象,e作为对象) System.Windows.Input.MouseButtonEventArgs')。C:\TFS\ProjectCollection\ItemManagementTool\ItemManagementTool.ClientApplication\Views\MainMenu.xaml.vb 82 70 ItemManagementTool.ClientApplication

对于“sender”参数,我得到了一个类似的错误。
有什么想法吗?

您缺少
关键字的
地址

AddHandler App.Current.RootVisual.MouseLeftButtonUp, AddressOf RootVisual_MouseLeftButtonUp

感谢您的提问和回答。我想补充一点,我犯了一个错误,在末尾有括号,即RootVisual_MouseLeftButtonUp()。当然,它不是那样的,但是你在看到它之前是不会知道的,就像这里贴的那样。谢谢