Compilation Error

R

Roland Hall

Can someone please explain this error to me?

Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.

Compiler Error Message: BC30408: Method 'Public Function compare(sender As
Object, e As System.EventArgs) As Object' does not have the same signature
as delegate 'Delegate Sub EventHandler(sender As Object, e As
System.EventArgs)'.

Source Error:



Line 16: <body MS_POSITIONING="GridLayout">
Line 17: <form runat="server">
Line 18: <asp:TextBox id="txtPersonReceiving" OnTextChanged="compare"
tabIndex="2" runat="server" Width="179" MaxLength="50" AutoPostBack="True"
Height="24px" />
Line 19: <p><asp:Label id="lbl1" Runat="server" /></p>
Line 20: </form>


Source:
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm3.aspx.vb"
Inherits="netfraud.us.WebForm3" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm3</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
<script runat=server>
Function compare(ByVal sender As Object, ByVal e As System.EventArgs)
lbl1.Text = txtPersonReceiving.Text
End Function
</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form runat="server">
<asp:TextBox id="txtPersonReceiving" OnTextChanged="compare" tabIndex="2"
runat="server" Width="179" MaxLength="50" AutoPostBack="True" Height="24px"
/>
<p><asp:Label id="lbl1" Runat="server" /></p>
</form>
</body>
</HTML>

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
 
D

Dave Fancher

I'm not a VB expert but I suspect that you're getting the error because
you're using a Function (that returns an object by default since no type is
specified) rather than a Sub (which has no return value). The EventHandler
delegate requires a Sub that takes an Object and an instance of EventArgs
for arguments, not a Function.

HTH
 
R

Roland Hall

in message : I'm not a VB expert but I suspect that you're getting the error because
: you're using a Function (that returns an object by default since no type
is
: specified) rather than a Sub (which has no return value). The
EventHandler
: delegate requires a Sub that takes an Object and an instance of EventArgs
: for arguments, not a Function.

Correct you are. Thank you Dave. I was using javascript earlier and forgot
about the function. ASP.NET is not as forgiving. I appreciate it.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,814
Latest member
SpicetreeDigital

Latest Threads

Top