just tinkering with a Sub Routine in ASP.NET

  • Thread starter Thread starter D. Shane Fowlkes
  • Start date Start date
D

D. Shane Fowlkes

Can someone please tell me what's wrong with this basic sub rountine? It's
supposed to just write 5 < hr /> lines to the page (I'm just teaching myself
as I read a book on .NET). It seems to error on the < % = WriteHR(5) % >
line.

THANKS!

**********************

<% @Page Language = "VB" Debug = "True" Explicit = "True" %>
<html>
<head>
<script runat="server">
Sub CreateHR(QTY As Integer)

Dim X As Integer
X = 1

Do While X <= QTY
Response.Write("<hr />" & vbcrlf)
X = X +1
Loop

End Sub
</script>
</head>
<body>
<p>We will write 5 Horizontal Lines.</p>
<% =CreateHR(5) %>
</body>
</html>

--


*********************************
D. Shane Fowlkes - TMM
Saving the world, one web site at a time.
http://www.shanefowlkes.com
*********************************
 
Shane,

It's rare that I see someone else who uses their name as an initial!

(Samuel J. Gengo VI)

I use Visual Studio.Net and code-behind pages so I might be wrong about
this, but I think that your <script> tags shouldn't be inside of the <head>
tags.

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 
I hand code as well. I don't trust any code generating software like
FrontPage or even the latest version of Dreamweaver (my tool of choice).

The <script> tag's location "isn't" supposed to matter.

The .Net error is:

Compiler Error Message: BC30518: Overload resolution failed because no
accessible 'Write' can be called with these arguments:

Line 28: <% =CreateHR(5) %>


Source File: C:\Data\DW Web Sites\test\subtest.aspx Line: 28


--


*********************************
D. Shane Fowlkes - TMM
Saving the world, one web site at a time.
http://www.shanefowlkes.com
*********************************
 
Just as an FYI, you should really consider moving to the code-behind
paradigm of ASP.NET. The coding you are using is just one step above
Classic ASP and there is so much more that can be gained by taking the next
step.
 
Back
Top