compile error on method not having same signature as delagate class 
Author Message
 compile error on method not having same signature as delagate class

I'm getting an compile error when try to use an asp:imagebutton. I'm not
sure why this is so. Here is the code and compile error.

<asp:ImageButton onClick="LogoutBtn_Click" runat="server" id="logout"
ImageUrl="logout.gif" />

Code behind:

Imports System

Imports System.Web.UI

Imports System.Web.UI.WebControls

Public Function LogoutBtn_Click(ByVal sender As Object, ByVal e As
ImageClickEventArgs)

Session.Clear()

Response.Redirect("Logon.aspx")

End Function

I've tried eventArgs as well in place of ImageClickEventArgs and still the
same compile error.

Compile error:

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

Can anyone help?



Mon, 11 Apr 2005 01:51:28 GMT  
 compile error on method not having same signature as delagate class
I believe you need to define your event handler as a sub, not a function

Hope that helps,
Alexandre
VB Team

--
This posting is provided "AS IS" with no warranties, and confers no rights.

___

Quote:
> I'm getting an compile error when try to use an asp:imagebutton. I'm not
> sure why this is so. Here is the code and compile error.

> <asp:ImageButton onClick="LogoutBtn_Click" runat="server" id="logout"
> ImageUrl="logout.gif" />

> Code behind:

> Imports System

> Imports System.Web.UI

> Imports System.Web.UI.WebControls

> Public Function LogoutBtn_Click(ByVal sender As Object, ByVal e As
> ImageClickEventArgs)

> Session.Clear()

> Response.Redirect("Logon.aspx")

> End Function

> I've tried eventArgs as well in place of ImageClickEventArgs and still the
> same compile error.

> Compile error:

> Method 'Public Function LogoutBtn_Click(sender As Object, e As
> System.Web.UI.ImageClickEventArgs) As Object' does not have the same
> signature as delegate 'Delegate Sub ImageClickEventHandler(sender As
Object,
> e As System.Web.UI.ImageClickEventArgs)'.

> Can anyone help?



Mon, 11 Apr 2005 03:53:05 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Public Method in a class calling a private method in same class yields ByRef error

2. Compile Error: EndKey Method not found

3. Compile error : Method or data member not found

4. Compile error : Method or data member not found

5. Compile Error : Method or Data Member not Found

6. Error 405(Method not allowed) error in using webclient.uploadfile method

7. class name not found after compiling DLL

8. Find out if somebody make an instance of a Class without having access to the Class

9. Compiling simple functions, not classes, in dlls

10. Error 430 : Class does not support Automation or Does not support expected Interface

11. VB4 and DAO 3.6 Update method Compile Error

12. Compile error Re Method or Data Member

 

 
Powered by phpBB® Forum Software