473,408 Members | 2,839 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,408 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 1289
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.