jodyglidden
asked on
Syntax error about imports having to precede declarations
I have the following code that is giving me an error:
Imports statements must precede declarations. My imports is before my declarations. Any idea what I'm doing wrong?
<%@ Page Language="VB" %>
<script runat="server">
Imports Microsoft.Win32
dim Accountskey as registrykey
Accountskey = Registry.CurrentUser.OpenS ubKey("Sof tware\VB and VBA Program Settings\Mailgov (Redirector)\AccountSettin gs", False)
for each strAccount in Accountskey.getvaluenames( )
strAccounts = strAccounts & strAccount
next
Label1.text = strAccounts
</script>
<html>
<head>
</head>
<body>
<form runat="server">
Done
<asp:TextBox id="TextBox1" runat="server"></asp:TextB ox>
<asp:Label id="Label1" runat="server">Label</asp: Label>
<!-- Insert content here -->
</form>
</body>
</html>
Imports statements must precede declarations. My imports is before my declarations. Any idea what I'm doing wrong?
<%@ Page Language="VB" %>
<script runat="server">
Imports Microsoft.Win32
dim Accountskey as registrykey
Accountskey = Registry.CurrentUser.OpenS
for each strAccount in Accountskey.getvaluenames(
strAccounts = strAccounts & strAccount
next
Label1.text = strAccounts
</script>
<html>
<head>
</head>
<body>
<form runat="server">
Done
<asp:TextBox id="TextBox1" runat="server"></asp:TextB
<asp:Label id="Label1" runat="server">Label</asp:
<!-- Insert content here -->
</form>
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That's what I've read as well. Also, Timbo fixed my bug. Thanks.
ASP.NET does NOT support coding as you have it here, which is the older ASP style, using embedded VBScript. In fact, you cannot embed VBScript in the ASPX page, in any fashion.
ASP.NET is a completely DIFFERENT style of web development, and you would be VERY wise to TOTALLY FORGET (yes FORGET) everything your ever knew (or thought you knew) about ASP development, becuase it has ABSOLUTELY no relevance to ASP.NET development. The two are as different as Night and Day - actually they are more different - say like Cats and Airplanes.
AW