By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,813 Members | 1,257 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,813 IT Pros & Developers. It's quick & easy.

HELP - Not recognizing VB Sub's

P: n/a
<Reply-To: ve*****@sympatico.ca>

Hello,

I'm hoping someone can help me out here... I'm a beginner ASP.NET
developper, and am trying to follow a series of exercises in the book
entitled "Microsoft ASP.NET Step By Step" by Microsoft Press.

When I try to display *any* ASP.NET page with a Sub() somewhere, I get the
following error:

------ BEGIN ERROR MESSAGE -------------
Line: 5
Char: 9
Error: Expected ';'
Code:0
URL: http://localhost/Exercises/HelloContainer.aspx
------ END ERROR MESSAGE -----------------

I thought this might have something to do with the fact that the compiler
thinks I want to use a different language than VB. So I set the "Page
Language" directive to "VB", as indicated in the code below.

Here is the code for "HelloContainer.aspx". Note that the line# and char#
in the error message corresponds to the space after the "Sub" decleration.

------ BEGIN HelloContainer.aspx ------------------
<%@ Page Language="vb" %>
<%@ Register TagPrefix="ASPNETSBS" TagName="Hello" Src="Hello.ascx" %>

<script runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
MyHello.Name = "Andrew"
MYHello.SayHello
End Sub

</script>
<html>
<head>
</head>
<body>
<ASPNETSBS:Hello id="MyHello" runat="server"
OnLoad="MyHello_Load"></ASPNETSBS:Hello>
</body>
</html>
-------------------------------------------------------------

I am getting very frustrated... No matter what is after the "Sub" it won't
continue past that point. I tried creating a GLOBAL.ASAX file, and a
WEB.CONFIG file, but to no avail...

Any help would be appreciated.

Please send replies to: ve*****@sympatico.ca

Thanks a million!
Nov 18 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
The error might not be what you think. This looks like a browser error, not
a server error. If it's a browser error than there is a good chance it has
absolutely nothing to do with the sub. Use a View Source in IE to view the
actual code that the browser is throwing the error from. Chances are it's
some JavaScript that is throwing the error that is being emitted by the
control or one of the controls as JavaScript will usually get emitted at the
very top of the file.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

"Marc Violette" <ve*****@sympatico.ca> wrote in message
news:OL*************@TK2MSFTNGP12.phx.gbl...
<Reply-To: ve*****@sympatico.ca>

Hello,

I'm hoping someone can help me out here... I'm a beginner ASP.NET
developper, and am trying to follow a series of exercises in the book
entitled "Microsoft ASP.NET Step By Step" by Microsoft Press.

When I try to display *any* ASP.NET page with a Sub() somewhere, I get the
following error:

------ BEGIN ERROR MESSAGE -------------
Line: 5
Char: 9
Error: Expected ';'
Code:0
URL: http://localhost/Exercises/HelloContainer.aspx
------ END ERROR MESSAGE -----------------

I thought this might have something to do with the fact that the compiler
thinks I want to use a different language than VB. So I set the "Page
Language" directive to "VB", as indicated in the code below.

Here is the code for "HelloContainer.aspx". Note that the line# and char#
in the error message corresponds to the space after the "Sub" decleration.

------ BEGIN HelloContainer.aspx ------------------
<%@ Page Language="vb" %>
<%@ Register TagPrefix="ASPNETSBS" TagName="Hello" Src="Hello.ascx" %>

<script runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
MyHello.Name = "Andrew"
MYHello.SayHello
End Sub

</script>
<html>
<head>
</head>
<body>
<ASPNETSBS:Hello id="MyHello" runat="server"
OnLoad="MyHello_Load"></ASPNETSBS:Hello>
</body>
</html>
-------------------------------------------------------------

I am getting very frustrated... No matter what is after the "Sub" it
won't
continue past that point. I tried creating a GLOBAL.ASAX file, and a
WEB.CONFIG file, but to no avail...

Any help would be appreciated.

Please send replies to: ve*****@sympatico.ca

Thanks a million!

Nov 18 '05 #2

P: n/a
Hi,

Thanks for the tip, but no go... No matter what I type in between the
"<script>" the compiler doesn't seem to understand it. I am running .NET FW
1.1 and basic code appears to work (like the simple "Response.Write")
function, but nothing else...

Any other ideas ?

Thanks again.
"Mark Fitzpatrick" <ma******@fitzme.com> wrote in message
news:em**************@tk2msftngp13.phx.gbl...
The error might not be what you think. This looks like a browser error, not a server error. If it's a browser error than there is a good chance it has
absolutely nothing to do with the sub. Use a View Source in IE to view the
actual code that the browser is throwing the error from. Chances are it's
some JavaScript that is throwing the error that is being emitted by the
control or one of the controls as JavaScript will usually get emitted at the very top of the file.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

"Marc Violette" <ve*****@sympatico.ca> wrote in message
news:OL*************@TK2MSFTNGP12.phx.gbl...
<Reply-To: ve*****@sympatico.ca>

Hello,

I'm hoping someone can help me out here... I'm a beginner ASP.NET
developper, and am trying to follow a series of exercises in the book
entitled "Microsoft ASP.NET Step By Step" by Microsoft Press.

When I try to display *any* ASP.NET page with a Sub() somewhere, I get the following error:

------ BEGIN ERROR MESSAGE -------------
Line: 5
Char: 9
Error: Expected ';'
Code:0
URL: http://localhost/Exercises/HelloContainer.aspx
------ END ERROR MESSAGE -----------------

I thought this might have something to do with the fact that the compiler thinks I want to use a different language than VB. So I set the "Page
Language" directive to "VB", as indicated in the code below.

Here is the code for "HelloContainer.aspx". Note that the line# and char# in the error message corresponds to the space after the "Sub" decleration.
------ BEGIN HelloContainer.aspx ------------------
<%@ Page Language="vb" %>
<%@ Register TagPrefix="ASPNETSBS" TagName="Hello" Src="Hello.ascx" %>

<script runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
MyHello.Name = "Andrew"
MYHello.SayHello
End Sub

</script>
<html>
<head>
</head>
<body>
<ASPNETSBS:Hello id="MyHello" runat="server"
OnLoad="MyHello_Load"></ASPNETSBS:Hello>
</body>
</html>
-------------------------------------------------------------

I am getting very frustrated... No matter what is after the "Sub" it
won't
continue past that point. I tried creating a GLOBAL.ASAX file, and a
WEB.CONFIG file, but to no avail...

Any help would be appreciated.

Please send replies to: ve*****@sympatico.ca

Thanks a million!


Nov 18 '05 #3

P: n/a
My initial guess is that something's wrong in your Hello.ascx page and/or
codebehind.

Karl

"Marc Violette" <ve*****@sympatico.ca> wrote in message
news:u0**************@TK2MSFTNGP10.phx.gbl...
Hi,

Thanks for the tip, but no go... No matter what I type in between the
"<script>" the compiler doesn't seem to understand it. I am running .NET FW 1.1 and basic code appears to work (like the simple "Response.Write")
function, but nothing else...

Any other ideas ?

Thanks again.
"Mark Fitzpatrick" <ma******@fitzme.com> wrote in message
news:em**************@tk2msftngp13.phx.gbl...
The error might not be what you think. This looks like a browser error,

not
a server error. If it's a browser error than there is a good chance it has
absolutely nothing to do with the sub. Use a View Source in IE to view the actual code that the browser is throwing the error from. Chances are it's some JavaScript that is throwing the error that is being emitted by the
control or one of the controls as JavaScript will usually get emitted at

the
very top of the file.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

"Marc Violette" <ve*****@sympatico.ca> wrote in message
news:OL*************@TK2MSFTNGP12.phx.gbl...
<Reply-To: ve*****@sympatico.ca>

Hello,

I'm hoping someone can help me out here... I'm a beginner ASP.NET
developper, and am trying to follow a series of exercises in the book
entitled "Microsoft ASP.NET Step By Step" by Microsoft Press.

When I try to display *any* ASP.NET page with a Sub() somewhere, I get

the following error:

------ BEGIN ERROR MESSAGE -------------
Line: 5
Char: 9
Error: Expected ';'
Code:0
URL: http://localhost/Exercises/HelloContainer.aspx
------ END ERROR MESSAGE -----------------

I thought this might have something to do with the fact that the compiler thinks I want to use a different language than VB. So I set the "Page
Language" directive to "VB", as indicated in the code below.

Here is the code for "HelloContainer.aspx". Note that the line# and char# in the error message corresponds to the space after the "Sub" decleration.
------ BEGIN HelloContainer.aspx ------------------
<%@ Page Language="vb" %>
<%@ Register TagPrefix="ASPNETSBS" TagName="Hello" Src="Hello.ascx" %>

<script runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
MyHello.Name = "Andrew"
MYHello.SayHello
End Sub

</script>
<html>
<head>
</head>
<body>
<ASPNETSBS:Hello id="MyHello" runat="server"
OnLoad="MyHello_Load"></ASPNETSBS:Hello>
</body>
</html>
-------------------------------------------------------------

I am getting very frustrated... No matter what is after the "Sub" it
won't
continue past that point. I tried creating a GLOBAL.ASAX file, and a
WEB.CONFIG file, but to no avail...

Any help would be appreciated.

Please send replies to: ve*****@sympatico.ca

Thanks a million!



Nov 18 '05 #4

P: n/a
Hi, thanks for your help...

It appears it is *all* of my user controls... No matter what control I use
(either ones I develop or the sample ones from the CD), I always get the
same error message saying I am missing a ";" before the first Sub of any
embedded <script> sections.

Does anyone know of a section in a configuration file that would have
anything to do with this ?

Maybe I'll try a C# script instead of a VB script... This would help
determine if it is a problem with the compiler not recognizing the Sub, or
if it's a more complex issue surrounding my installation.

Thanks.
"Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
message news:u0*************@tk2msftngp13.phx.gbl...
My initial guess is that something's wrong in your Hello.ascx page and/or
codebehind.

Karl

"Marc Violette" <ve*****@sympatico.ca> wrote in message
news:u0**************@TK2MSFTNGP10.phx.gbl...
Hi,

Thanks for the tip, but no go... No matter what I type in between the
"<script>" the compiler doesn't seem to understand it. I am running ..NET
FW
1.1 and basic code appears to work (like the simple "Response.Write")
function, but nothing else...

Any other ideas ?

Thanks again.
"Mark Fitzpatrick" <ma******@fitzme.com> wrote in message
news:em**************@tk2msftngp13.phx.gbl...
The error might not be what you think. This looks like a browser error,
not
a server error. If it's a browser error than there is a good chance it has absolutely nothing to do with the sub. Use a View Source in IE to view the actual code that the browser is throwing the error from. Chances are it's some JavaScript that is throwing the error that is being emitted by

the control or one of the controls as JavaScript will usually get emitted at the
very top of the file.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

"Marc Violette" <ve*****@sympatico.ca> wrote in message
news:OL*************@TK2MSFTNGP12.phx.gbl...
> <Reply-To: ve*****@sympatico.ca>
>
> Hello,
>
> I'm hoping someone can help me out here... I'm a beginner ASP.NET
> developper, and am trying to follow a series of exercises in the
book > entitled "Microsoft ASP.NET Step By Step" by Microsoft Press.
>
> When I try to display *any* ASP.NET page with a Sub() somewhere, I get the
> following error:
>
> ------ BEGIN ERROR MESSAGE -------------
> Line: 5
> Char: 9
> Error: Expected ';'
> Code:0
> URL: http://localhost/Exercises/HelloContainer.aspx
> ------ END ERROR MESSAGE -----------------
>
> I thought this might have something to do with the fact that the

compiler
> thinks I want to use a different language than VB. So I set the

"Page > Language" directive to "VB", as indicated in the code below.
>
> Here is the code for "HelloContainer.aspx". Note that the line# and

char#
> in the error message corresponds to the space after the "Sub"

decleration.
>
> ------ BEGIN HelloContainer.aspx ------------------
> <%@ Page Language="vb" %>
> <%@ Register TagPrefix="ASPNETSBS" TagName="Hello" Src="Hello.ascx" %> >
> <script runat="server">
> Sub Page_Load(Sender As Object, E As EventArgs)
> MyHello.Name = "Andrew"
> MYHello.SayHello
> End Sub
>
> </script>
> <html>
> <head>
> </head>
> <body>
> <ASPNETSBS:Hello id="MyHello" runat="server"
> OnLoad="MyHello_Load"></ASPNETSBS:Hello>
> </body>
> </html>
> -------------------------------------------------------------
>
> I am getting very frustrated... No matter what is after the "Sub" it > won't
> continue past that point. I tried creating a GLOBAL.ASAX file, and a > WEB.CONFIG file, but to no avail...
>
> Any help would be appreciated.
>
> Please send replies to: ve*****@sympatico.ca
>
> Thanks a million!
>
>



Nov 18 '05 #5

P: n/a
This is true even if the user control is blank? What if it doens't have a
codebehind section?

In your web.config, what's the defaultLanguage of the compilation element
set to?

karl

"Marc Violette" <ve*****@sympatico.ca> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi, thanks for your help...

It appears it is *all* of my user controls... No matter what control I use (either ones I develop or the sample ones from the CD), I always get the
same error message saying I am missing a ";" before the first Sub of any
embedded <script> sections.

Does anyone know of a section in a configuration file that would have
anything to do with this ?

Maybe I'll try a C# script instead of a VB script... This would help
determine if it is a problem with the compiler not recognizing the Sub, or
if it's a more complex issue surrounding my installation.

Thanks.
"Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
message news:u0*************@tk2msftngp13.phx.gbl...
My initial guess is that something's wrong in your Hello.ascx page and/or
codebehind.

Karl

"Marc Violette" <ve*****@sympatico.ca> wrote in message
news:u0**************@TK2MSFTNGP10.phx.gbl...
Hi,

Thanks for the tip, but no go... No matter what I type in between the
"<script>" the compiler doesn't seem to understand it. I am running .NET
FW
1.1 and basic code appears to work (like the simple "Response.Write")
function, but nothing else...

Any other ideas ?

Thanks again.
"Mark Fitzpatrick" <ma******@fitzme.com> wrote in message
news:em**************@tk2msftngp13.phx.gbl...
> The error might not be what you think. This looks like a browser
error, not
> a server error. If it's a browser error than there is a good chance it has
> absolutely nothing to do with the sub. Use a View Source in IE to
view
the
> actual code that the browser is throwing the error from. Chances are

it's
> some JavaScript that is throwing the error that is being emitted by

the > control or one of the controls as JavaScript will usually get
emitted at the
> very top of the file.
>
> Hope this helps,
> Mark Fitzpatrick
> Microsoft MVP - FrontPage
>
> "Marc Violette" <ve*****@sympatico.ca> wrote in message
> news:OL*************@TK2MSFTNGP12.phx.gbl...
> > <Reply-To: ve*****@sympatico.ca>
> >
> > Hello,
> >
> > I'm hoping someone can help me out here... I'm a beginner ASP.NET
> > developper, and am trying to follow a series of exercises in the book > > entitled "Microsoft ASP.NET Step By Step" by Microsoft Press.
> >
> > When I try to display *any* ASP.NET page with a Sub() somewhere, I get the
> > following error:
> >
> > ------ BEGIN ERROR MESSAGE -------------
> > Line: 5
> > Char: 9
> > Error: Expected ';'
> > Code:0
> > URL: http://localhost/Exercises/HelloContainer.aspx
> > ------ END ERROR MESSAGE -----------------
> >
> > I thought this might have something to do with the fact that the
compiler
> > thinks I want to use a different language than VB. So I set the "Page > > Language" directive to "VB", as indicated in the code below.
> >
> > Here is the code for "HelloContainer.aspx". Note that the line#
and char#
> > in the error message corresponds to the space after the "Sub"
decleration.
> >
> > ------ BEGIN HelloContainer.aspx ------------------
> > <%@ Page Language="vb" %>
> > <%@ Register TagPrefix="ASPNETSBS" TagName="Hello"
Src="Hello.ascx" %> > >
> > <script runat="server">
> > Sub Page_Load(Sender As Object, E As EventArgs)
> > MyHello.Name = "Andrew"
> > MYHello.SayHello
> > End Sub
> >
> > </script>
> > <html>
> > <head>
> > </head>
> > <body>
> > <ASPNETSBS:Hello id="MyHello" runat="server"
> > OnLoad="MyHello_Load"></ASPNETSBS:Hello>
> > </body>
> > </html>
> > -------------------------------------------------------------
> >
> > I am getting very frustrated... No matter what is after the "Sub" it > > won't
> > continue past that point. I tried creating a GLOBAL.ASAX file,
and
a > > WEB.CONFIG file, but to no avail...
> >
> > Any help would be appreciated.
> >
> > Please send replies to: ve*****@sympatico.ca
> >
> > Thanks a million!
> >
> >
>
>



Nov 18 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.