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

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
RIASAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shaun KlineLead Software EngineerCommented:
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.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RIASAuthor Commented:
Thanks but need a parameter
0
Shaun KlineLead Software EngineerCommented:
Please re-read my previous comment.
0
AndyAinscowFreelance programmer / ConsultantCommented:
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)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.