Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Format + ASP?

Status
Not open for further replies.

testare

Programmer
Jan 21, 2005
127
I would like to loop and then show it on the browser.
For example 1 should be 01 and so on.
I don't want the numbers to be shown like this.
2
3
4
I would like to have the number displayed like this.
01
02
03
04

I noticed that format doesn't work in ASP like in Visual Basic.
In vb i do it like this.
Code:
Dim i As Long

For i = 0 To 42
    Debug.Print Format(i, "00")
Next

But what should i do in ASP
 
Get an error message with only this.
<%
For i = 0 To 42
i= "00" & "i"
Response.Write Right(i,2)
Next
%>
 
should be:

<%
For i = 0 To 42
i= "00" & i
Response.Write Right(i,2)
Next
%>

no quotes around i

-DNG
 
more precisely...
Code:
<% 
For i = 0 To 42
    i= "00" & i
    Response.Write    Right(i,2)&"<BR>"
Next
%>

sorry about the typo in my first post...

-DNG
 
I should check what could be wrong, insted of doing cut & paste.

Works perfekt now DotNetGnat, thank you.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top