470,648 Members | 1,396 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,648 developers. It's quick & easy.

Format(string.......etc

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)

Jul 19 '05 #1
7 3933
"Steven Burn" <nobody@PVT_it-mate.co.uk> wrote in message
news:uQ**************@TK2MSFTNGP09.phx.gbl...
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.
Jul 19 '05 #2
Steven Burn wrote:
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...onfeatures.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
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #3
See the FormatNumber function.

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

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Steven Burn" <nobody@PVT_it-mate.co.uk> wrote in message
news:uQ**************@TK2MSFTNGP09.phx.gbl...
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)

Jul 19 '05 #4
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)
Richard K Bethell <so*****@spammingisevil.bad> wrote in message
news:Ou**************@tk2msftngp13.phx.gbl...
"Steven Burn" <nobody@PVT_it-mate.co.uk> wrote in message
news:uQ**************@TK2MSFTNGP09.phx.gbl...
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.

Jul 19 '05 #5
Cheers

--
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)
Mark Schupp <ms*****@ielearning.com> wrote in message
news:eO**************@TK2MSFTNGP11.phx.gbl...
See the FormatNumber function.

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

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Steven Burn" <nobody@PVT_it-mate.co.uk> wrote in message
news:uQ**************@TK2MSFTNGP09.phx.gbl...
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)


Jul 19 '05 #6
Bob Barrows <re******@NOyahoo.SPAMcom> wrote in message
news:#P**************@TK2MSFTNGP12.phx.gbl...
<snip>

It's vbscript that doesn't support it (ASP is not a language).
http://msdn.microsoft.com/library/en...onfeatures.asp
</snip>

hehe, I know what I meant ;o)

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

</snip>

Cheers ;o)

--
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)
Jul 19 '05 #7
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)
Steven Burn <nobody@PVT_it-mate.co.uk> wrote in message
news:uQ**************@TK2MSFTNGP09.phx.gbl...
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)

Jul 19 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by kevininstructor | last post: by
6 posts views Thread by Servé Lau | last post: by
6 posts views Thread by Donal McWeeney | last post: by
2 posts views Thread by MM | last post: by
7 posts views Thread by Eddy Soeparmin | last post: by
4 posts views Thread by James | last post: by
3 posts views Thread by stathisgotsis | last post: by
7 posts views Thread by Tony Girgenti | last post: by
7 posts views Thread by moondaddy | last post: by
1 post views Thread by Korara | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.