Home All Groups Group Topic Archive Search About
Author
13 May 2007 11:59 AM
Barry
Hi

when creating a handler

AddHandler btn.Click, AddressOf btnAddProjectNotes

for the following delegate

Protected Sub btnAddProjectNotes_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnAddProjectNotes.Click

End Sub


if get this error messsage

Private Dim WithEvents btnAddProjectNotes As
System.Web.UI.WebControls.Button' does not have the same signature as
delegate 'Delegate Sub EventHandler(sender As Object, e As
System.EventArgs)'

how do i correct this problem

TIA
Barry

Author
13 May 2007 12:37 PM
Alvin Bruney [MVP]
I don't know VB that well but i think it is complaining about the protected
type.

--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
OWC Black book on Amazon and
www.lulu.com/owc
Professional VSTO 2005 - Wrox/Wiley


Show quote
"Barry" <some***@somewhere.com> wrote in message
news:OO5NZYVlHHA.1820@TK2MSFTNGP04.phx.gbl...
> Hi
>
> when creating a handler
>
> AddHandler btn.Click, AddressOf btnAddProjectNotes
>
> for the following delegate
>
> Protected Sub btnAddProjectNotes_Click(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles btnAddProjectNotes.Click
>
> End Sub
>
>
> if get this error messsage
>
> Private Dim WithEvents btnAddProjectNotes As
> System.Web.UI.WebControls.Button' does not have the same signature as
> delegate 'Delegate Sub EventHandler(sender As Object, e As
> System.EventArgs)'
>
> how do i correct this problem
>
> TIA
> Barry
>
>
Author
13 May 2007 2:03 PM
Rory Becker
> AddHandler btn.Click, AddressOf btnAddProjectNotes
>
> for the following delegate
>
> Protected Sub btnAddProjectNotes_Click(ByVal sender As Object, ByVal e
> As System.EventArgs) Handles btnAddProjectNotes.Click
> End Sub
>
> how do i correct this problem
>

You are trying to attach to the object rather than the method.

You should write...
-------------------------------------------------------------
AddHandler btn.Click, AddressOf btnAddProjectNotes_Click
-------------------------------------------------------------
....rather than...
-------------------------------------------------------------
AddHandler btn.Click, AddressOf btnAddProjectNotes
-------------------------------------------------------------

HTH

--
Rory
Author
13 May 2007 2:20 PM
Barry
Thanks for the reply, i did find out the error soon after i posted the
problem.

for more on the subject read my next post

Show quote
"Rory Becker" <RoryBecker@newsgroup.nospam> wrote in message
news:b0ac48a0d18f8c9638701407f00@msnews.microsoft.com...
>> AddHandler btn.Click, AddressOf btnAddProjectNotes
>>
>> for the following delegate
>>
>> Protected Sub btnAddProjectNotes_Click(ByVal sender As Object, ByVal e
>> As System.EventArgs) Handles btnAddProjectNotes.Click
>> End Sub
>>
>> how do i correct this problem
>>
>
> You are trying to attach to the object rather than the method.
>
> You should write...
> -------------------------------------------------------------
> AddHandler btn.Click, AddressOf btnAddProjectNotes_Click
> -------------------------------------------------------------
> ...rather than...
> -------------------------------------------------------------
> AddHandler btn.Click, AddressOf btnAddProjectNotes
> -------------------------------------------------------------
>
> HTH
>
> --
> Rory
>
>
>

AddThis Social Bookmark Button