Same function different signatures

T

tshad

I have a function that I want to jump to from 2 different controls
(ImageButton and LinkButton).

The problem is I get the error:

Method 'Public Sub PrintPage_Click(sender As Object, e As
System.Web.UI.ImageClickEventArgs)' does not have the same signature as
delegate 'Delegate Sub EventHandler(sender As Object, e As System.EventArgs)

Is there a way to call the same function from these 2 buttons?

Thanks,

Tom
 
M

Marina Levit [MVP]

Put all the logic that does the printing into its own function. Then call it
from both of the event handlers.
 
M

Marina Levit [MVP]

Why? Does it really matter?

You could change the PrintPage_Click method to have just EventArgs as the
second argument, which will be fine as long as you are not using any of the
information in the arguments you have now.

But in reality, it's not even worth doing. Creating another method is
trivial.
 
T

tshad

It doesn't really, I was just curious if I could.

And you're right about creating another method.

Thanks,

Tom
 

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

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top