Home All Groups Group Topic Archive Search About

Same function different signatures

Author
17 May 2006 4:03 PM
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

Author
17 May 2006 4:17 PM
Marina Levit [MVP]
Put all the logic that does the printing into its own function. Then call it
from both of the event handlers.

Show quoteHide quote
"tshad" <tscheider***@ftsolutions.com> wrote in message
news:u%23cxAuceGHA.4304@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
>
Are all your drivers up to date? click for free checkup

Author
17 May 2006 4:44 PM
tshad
That's what I thought.

I was hoping to do it from one function.

Thanks,

Tom
Show quoteHide quote
"Marina Levit [MVP]" <someone@nospam.com> wrote in message
news:OCbCX1ceGHA.3388@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" <tscheider***@ftsolutions.com> wrote in message
> news:u%23cxAuceGHA.4304@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
>>
>
>
Author
17 May 2006 5:23 PM
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.

Show quoteHide quote
"tshad" <tscheider***@ftsolutions.com> wrote in message
news:ekRhgEdeGHA.1456@TK2MSFTNGP04.phx.gbl...
> That's what I thought.
>
> I was hoping to do it from one function.
>
> Thanks,
>
> Tom
> "Marina Levit [MVP]" <someone@nospam.com> wrote in message
> news:OCbCX1ceGHA.3388@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" <tscheider***@ftsolutions.com> wrote in message
>> news:u%23cxAuceGHA.4304@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
>>>
>>
>>
>
>
Author
17 May 2006 8:04 PM
tshad
It doesn't really, I was just curious if I could.

And you're right about creating another method.

Thanks,

Tom
Show quoteHide quote
"Marina Levit [MVP]" <someone@nospam.com> wrote in message
news:eeN4PadeGHA.3900@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" <tscheider***@ftsolutions.com> wrote in message
> news:ekRhgEdeGHA.1456@TK2MSFTNGP04.phx.gbl...
>> That's what I thought.
>>
>> I was hoping to do it from one function.
>>
>> Thanks,
>>
>> Tom
>> "Marina Levit [MVP]" <someone@nospam.com> wrote in message
>> news:OCbCX1ceGHA.3388@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" <tscheider***@ftsolutions.com> wrote in message
>>> news:u%23cxAuceGHA.4304@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
>>>>
>>>
>>>
>>
>>
>
>

Bookmark and Share