473,287 Members | 1,827 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

Same function different signatures

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
May 17 '06 #1
4 1284
Put all the logic that does the printing into its own function. Then call it
from both of the event handlers.

"tshad" <ts**********@ftsolutions.com> wrote in message
news:u%****************@TK2MSFTNGP05.phx.gbl...
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

May 17 '06 #2
That's what I thought.

I was hoping to do it from one function.

Thanks,

Tom
"Marina Levit [MVP]" <so*****@nospam.com> wrote in message
news:OC**************@TK2MSFTNGP05.phx.gbl...
Put all the logic that does the printing into its own function. Then call
it from both of the event handlers.

"tshad" <ts**********@ftsolutions.com> wrote in message
news:u%****************@TK2MSFTNGP05.phx.gbl...
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


May 17 '06 #3
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.

"tshad" <ts**********@ftsolutions.com> wrote in message
news:ek**************@TK2MSFTNGP04.phx.gbl...
That's what I thought.

I was hoping to do it from one function.

Thanks,

Tom
"Marina Levit [MVP]" <so*****@nospam.com> wrote in message
news:OC**************@TK2MSFTNGP05.phx.gbl...
Put all the logic that does the printing into its own function. Then call
it from both of the event handlers.

"tshad" <ts**********@ftsolutions.com> wrote in message
news:u%****************@TK2MSFTNGP05.phx.gbl...
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



May 17 '06 #4
It doesn't really, I was just curious if I could.

And you're right about creating another method.

Thanks,

Tom
"Marina Levit [MVP]" <so*****@nospam.com> wrote in message
news:ee**************@TK2MSFTNGP05.phx.gbl...
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.

"tshad" <ts**********@ftsolutions.com> wrote in message
news:ek**************@TK2MSFTNGP04.phx.gbl...
That's what I thought.

I was hoping to do it from one function.

Thanks,

Tom
"Marina Levit [MVP]" <so*****@nospam.com> wrote in message
news:OC**************@TK2MSFTNGP05.phx.gbl...
Put all the logic that does the printing into its own function. Then
call it from both of the event handlers.

"tshad" <ts**********@ftsolutions.com> wrote in message
news:u%****************@TK2MSFTNGP05.phx.gbl...
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



May 17 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: garyolsen | last post by:
class base{ public: void NonVirtualMethod(int a); virtual void VirtualMethod(int a); }; class derived{ public: void NonVirtualMethod(int a, char c); void VirtualMethod(int a, char c);
4
by: Alex Vinokur | last post by:
Hi, I need something like "function inheritance". typedef void (*func_type1) (int); typedef int (*func_type2) (double); typedef char (*func_type3) (short, int); .... I need a vector...
4
by: don | last post by:
I have two existing interfaces having methods with same names. Now I have to implement both intrfaces in one class. Is there any way I could implement methods with same names in both interfaces...
3
by: Felix_Jiang | last post by:
The following code returns different result when running on dotnetFramework 1.1 and 2.0. For 1.1, it returns "Object". For 2.0, it returns "String". Can anyone explain to me why? Thanks! ...
18
by: John Friedland | last post by:
My problem: I need to call (from C code) an arbitrary C library function, but I don't know until runtime what the function name is, how many parameters are required, and what the parameters are. I...
16
by: Zytan | last post by:
MSDN says: "The ref and out keywords are treated differently at run- time, but they are treated the same at compile time. Therefore methods cannot be overloaded if one method takes a ref argument...
10
by: _mario.lat | last post by:
hallo, what does it means "the function is not thread-safe"? thak you in advance, Mario.
7
by: ashjas | last post by:
Hello, I have run this logic on turboc++ 3.0 and it is working fine on it but its not running on msvs2008 c++. i am not able to assign the value like this *temp=*main,where main and temp are char...
20
by: MikeC | last post by:
Folks, I've been playing with C programs for 25 years (not professionally - self-taught), and although I've used function pointers before, I've never got my head around them enough to be able to...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.