Nizix
asked on
Asp.net label not declared
Hi, im fairly new to asp.net and i need some help fixing my code for test.aspx (all on one page, no codebehind), heres the page:
<%@ Page Language="vb" %>
<%@ import Namespace="System" %>
<%@ Import Namespace="System.Data" %>
<script Language="VB" Debug="true" RunAt="Server">
Private Sub Page_load (byval sender as system.object, byval e as system.eventargs) handles mybase.load
'Protected WithEvents lblresult As Label.
dim strchoice as string
strchoice = "one"
mysub(strchoice)
lblresult.text = strchoice
End sub
Private sub mysub(byref strtemp as string)
strtemp= "two"
End sub
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor. Document">
</head>
<body>
<form runat="server">
<asp:Label id="lblResult">
</asp:Label>
</form>
</body>
</html>
when i run it i get this error:
Compiler Error Message: BC30451: Name 'lblresult' is not declared.
ive tried:
"dim lblresult as label" and "Protected WithEvents lblresult As Label."
I dont know what is wrong, but i know it should be fairly easy to fix. Do i need to make a class for this thing work, cause i dont think i should (its asp.net 1.1)? Dont worry about the byval and byref, that was what i was planning to test before i got that error. Help please, thanks
<%@ Page Language="vb" %>
<%@ import Namespace="System" %>
<%@ Import Namespace="System.Data" %>
<script Language="VB" Debug="true" RunAt="Server">
Private Sub Page_load (byval sender as system.object, byval e as system.eventargs) handles mybase.load
'Protected WithEvents lblresult As Label.
dim strchoice as string
strchoice = "one"
mysub(strchoice)
lblresult.text = strchoice
End sub
Private sub mysub(byref strtemp as string)
strtemp= "two"
End sub
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.
</head>
<body>
<form runat="server">
<asp:Label id="lblResult">
</asp:Label>
</form>
</body>
</html>
when i run it i get this error:
Compiler Error Message: BC30451: Name 'lblresult' is not declared.
ive tried:
"dim lblresult as label" and "Protected WithEvents lblresult As Label."
I dont know what is wrong, but i know it should be fairly easy to fix. Do i need to make a class for this thing work, cause i dont think i should (its asp.net 1.1)? Dont worry about the byval and byref, that was what i was planning to test before i got that error. Help please, thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.