<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="gb2312" %>
<script language="vb" runat="server">
public dim b as object = new button()
sub page_load(byval sender as object,byval e as eventargs)
b.text = "hello"
b.id = "b"
addhandler b.click, addressof b_click
lable1.Controls.add(b)
end sub
Private Sub b_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
msgbox("TEST!!!")
end sub
</script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>fate stay night</title>
</head>
<body><form runat = "server">
<asp:label id = lable1 runat =server/>
<asp:label id = label2 runat = server/>
</form></body>
</HTML>
执行结果
“/”应用程序中的服务器错误。
编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。
编译器错误信息: BC30676: “click”不是“System.Object”的事件。
源错误:
|
行 7:
行 8:
行 9: addhandler b.click, addressof b_click
行 10:
行 11: lable1.Controls.add(b)
|
源文件: E:\jsjj\Default.aspx 行: 9
显示详细的编译器输出:
c:\windows\system32\inetsrv> "c:\windows\microsoft.net\framework\v1.1.4322\vbc.exe" /t:library /utf8output /R:"c:\windows\assembly\gac\system.enterpriseservices\1.0.5000.0__b03f5f7f11d50a3a\system.enterpriseservices.dll" /R:"c:\windows\assembly\gac\system.data\1.0.5000.0__b77a5c561934e089\system.data.dll" /R:"c:\windows\assembly\gac\system.web.mobile\1.0.5000.0__b03f5f7f11d50a3a\system.web.mobile.dll" /R:"c:\windows\assembly\gac\system.drawing\1.0.5000.0__b03f5f7f11d50a3a\system.drawing.dll" /R:"c:\windows\assembly\gac\system.xml\1.0.5000.0__b77a5c561934e089\system.xml.dll" /R:"c:\windows\assembly\gac\system.web.services\1.0.5000.0__b03f5f7f11d50a3a\system.web.services.dll" /R:"c:\windows\assembly\gac\system\1.0.5000.0__b77a5c561934e089\system.dll" /R:"c:\windows\assembly\gac\system.web\1.0.5000.0__b03f5f7f11d50a3a\system.web.dll" /out:"c:\windows\microsoft.net\framework\v1.1.4322\Temporary ASP.NET Files\root\5eb2dc37\1fae5d4d\ydpx5ce1.dll" /D:DEBUG=1 /debug+ "c:\windows\microsoft.net\framework\v1.1.4322\Temporary ASP.NET Files\root\5eb2dc37\1fae5d4d\ydpx5ce1.0.vb"
Microsoft (R) Visual Basic .NET 编译器版本 7.10.6310.4
用于 Microsoft (R) .NET Framework 版本 1.1.4322.2300
版权所有 (C) Microsoft Corporation 1987-2000。保留所有权利。
E:\jsjj\Default.aspx(9) : error BC30676: “click”不是“System.Object”的事件。
addhandler b.click, addressof b_click
~~~~~
|
失败了