Format(string.......etc

S

Steven Burn

Anyone able to tell me if there's an alternative to the Format function that
VB has? (it appears ASP doesn't support it)

I'm basically (and believe me, I know how stupid this is going to sound)
trying to find a way of getting a file/folder's size to show in something
other than bytes (i.e. KB or MB, depending on what size it is).

I've tried modifying some of my VB functions to ASP compatable, but it
doesn't seem to like them.

E.G. in VB, I use;

something = Format((Fldr.Size / 1024), "#0.00") & " KB"

or

Format((Fldr.Size / 1024) / 1024, "##0.00") & " MB"

Neither of the above seem to work as below;

Response.Write Format((Fldr.Size / 1024) / 1024, "##0.00") & " MB"

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
 
R

Richard K Bethell

Steven Burn said:
Anyone able to tell me if there's an alternative to the Format function that
VB has? (it appears ASP doesn't support it)

I'm basically (and believe me, I know how stupid this is going to sound)
trying to find a way of getting a file/folder's size to show in something
other than bytes (i.e. KB or MB, depending on what size it is).

I've tried modifying some of my VB functions to ASP compatable, but it
doesn't seem to like them.

E.G. in VB, I use;

something = Format((Fldr.Size / 1024), "#0.00") & " KB"

Why not simply perform the math operation (without the Format command) on a
variable, and then Response.Write it with "KB" appended as a string?

R.
 
B

Bob Barrows

Steven said:
Anyone able to tell me if there's an alternative to the Format
function that VB has? (it appears ASP doesn't support it)

It's vbscript that doesn't support it (ASP is not a language).
http://msdn.microsoft.com/library/en-us/script56/html/vsgrpnonfeatures.asp
I'm basically (and believe me, I know how stupid this is going to
sound) trying to find a way of getting a file/folder's size to show
in something other than bytes (i.e. KB or MB, depending on what size
it is).

I've tried modifying some of my VB functions to ASP compatable, but it
doesn't seem to like them.

E.G. in VB, I use;

something = Format((Fldr.Size / 1024), "#0.00") & " KB"

or

Format((Fldr.Size / 1024) / 1024, "##0.00") & " MB"

Neither of the above seem to work as below;

Response.Write Format((Fldr.Size / 1024) / 1024, "##0.00") & " MB"

http://www.aspfaq.com/show.asp?id=2313

HTH,
Bob Barrows
 
S

Steven Burn

hehe, I've just thought of that aswell.

Haven't tried it yet, but if I'm correct, then the below should work???

Response.Write fldr.Size /1024 & " KB"

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
 
M

Mark Schupp

See the FormatNumber function.

You will still have to perform the division but FormatNumber can control the
number of places after the decimal point.
 
S

Steven Burn

I've sorted it, thanks for the replies guys.......

Function FeckIt(florfldr)
FeckIt = formatnumber((cdbl(florfldr)/1024),0):If FeckIt < 1 then FeckIt
= 1
End Function

Response.Write FeckIt(File.Size) & " KB"

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

use the oleDBCommand in ASP 2
Replace Function 6
Block "HEAD" method? 2
Response. and Request. 2
OT - sending HTML email 2
IsNumeric problem.... 5
IIS 4
[Perhaps OT] Zip 2

Members online

No members online now.

Forum statistics

Threads
474,141
Messages
2,570,817
Members
47,362
Latest member
ChandaWagn

Latest Threads

Top