Address of operand must be the name of a method+vb.net

RIAS
RIAS used Ask the Experts™
on
Hi,
I am trying to call the method


 AddHandler menuItem4.Click, AddressOf CopyEditVehMain_Click(dgv)
I get an error : addressof operand must be the name of a method+vb.net


Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Lead Software Engineer
Commented:
This will make the error disappear:

AddHandler menuItem4.Click, AddressOf CopyEditVehMain_Click

When you raise the event, that is when you provide the required parameters.

Author

Commented:
Thanks but need a parameter
Shaun KlineLead Software Engineer

Commented:
Please re-read my previous comment.
AndyAinscowFreelance programmer / Consultant

Commented:
Doesn't work that way.
You are adding the location of a method that the event will use.  When the event is raised then the parameters are supplied.

(You don't create a string class to hold "Hello" and a different class with methods etc to hold "world"  - you create variables of that general type)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial