主题:刚学 语法问题
<script Language="VB" runat="server">
class userinfo
public user_name as string
public birthday as date
public function legality() as string
dim age as integer
age= datediff("yyyy",birthday,today())
if age >=18 then
return "你已经达到规定年龄"
else
return "你no达到规定年龄"
end if
end function
sub page_load (sender as object,e as eventargs)
dim objuser as new userinfo
objuser.user_name="喝令"
objuser.birthday=#09/09/1985#
message.text="你的姓名是"&objuser.user_name
message2.text="你的生日"&objuser.user_birthday
message2.text=objuser.legality()
end sub
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<asp:Label id="message" runat="server"/>
<asp:Label id="message2" runat="server"/>
<asp:Label id="message3" runat="server"/>
</body>
</html>
_____________________________________________________________________________
编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。
编译器错误信息: BC30456: “message”不是“ASP._2_9_aspx.userinfo”的成员。
源错误:
行 1: <script Language="VB" runat="server">
行 2: class userinfo
行 3: public user_name as string
class userinfo
public user_name as string
public birthday as date
public function legality() as string
dim age as integer
age= datediff("yyyy",birthday,today())
if age >=18 then
return "你已经达到规定年龄"
else
return "你no达到规定年龄"
end if
end function
sub page_load (sender as object,e as eventargs)
dim objuser as new userinfo
objuser.user_name="喝令"
objuser.birthday=#09/09/1985#
message.text="你的姓名是"&objuser.user_name
message2.text="你的生日"&objuser.user_birthday
message2.text=objuser.legality()
end sub
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<asp:Label id="message" runat="server"/>
<asp:Label id="message2" runat="server"/>
<asp:Label id="message3" runat="server"/>
</body>
</html>
_____________________________________________________________________________
编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。
编译器错误信息: BC30456: “message”不是“ASP._2_9_aspx.userinfo”的成员。
源错误:
行 1: <script Language="VB" runat="server">
行 2: class userinfo
行 3: public user_name as string