1

I'm trying to add a handler, but as soon as I'm targetting a method that has parameters, the handler fails. This is the simple code:

AddHandler App.Current.RootVisual.MouseLeftButtonUp, RootVisual_MouseLeftButtonUp

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

End Sub

This error won't let me build. When looking at the examples, I'm doing it right. This is the error I get:

Error 3 Argument not specified for parameter 'e' of 'Private Sub RootVisual_MouseLeftButtonUp(sender As Object, e As System.Windows.Input.MouseButtonEventArgs)'. C:\TFS\ProjectCollection\ItemManagementTool\ItemManagementTool.ClientApplication\Views\MainMenu.xaml.vb 82 70 ItemManagementTool.ClientApplication

I get a similar error for the "sender" parameter. Any ideas?

1 Answer 1

3

You are missing the AddressOf keyword

AddHandler App.Current.RootVisual.MouseLeftButtonUp, AddressOf RootVisual_MouseLeftButtonUp
Sign up to request clarification or add additional context in comments.

1 Comment

Appreciated this question and answer. Thought I would add that I was making the mistake of having parenthesis at the end, i.e. RootVisual_MouseLeftButtonUp(). It doesn't like that, of course, but you don't know until you see it, as posted here. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.