Error in source as object, e as envenargs

A

Al

hi , I am creating a form in asp.net and in the form, I
crateed a couple of buttons, when I call a function I get
the following error :
Method 'Public Sub (function name) does not have the same
signature as delegate ' Delegate Sub EventHandler(sender
as object, e as system.eventArgs)'

I figured out that I must put the following at my funcion
sub calcualte_int(source as object, e as EventArgs)
.. process
end sub

what if I want to pass a value to the above function, do I
add input parameter like this
sub calcualte_int(source as object, e as EventArgs , intID
as integer)
.. process
end sub

Thanks for your help. and sorry if this is a silly
question, I am new to asp.net though :)
Al
 
J

Jeff Levinson [mcsd.net]

The way to handle this is the following:
1. Create a new class that inherits from the
System.EventArgs class.
2. Add the property for the value you want to pass to the
method.
3. When you raise the event make sure you pass in your
inherited EventArgs class and the property you want to
pass is set correctly.

That's all there is to it.

Jeff Levinson
Author of "Building Client/Server Applications with
VB.NET: An Example Driven Approach"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top