473,835 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Si ze / 1024), "#0.00") & " KB"

or

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

Neither of the above seem to work as below;

Response.Write Format((Fldr.Si ze / 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 4029
"Steven Burn" <nobody@PVT_i t-mate.co.uk> wrote in message
news:uQ******** ******@TK2MSFTN GP09.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.Si ze / 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.Si ze / 1024), "#0.00") & " KB"

or

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

Neither of the above seem to work as below;

Response.Write Format((Fldr.Si ze / 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_i t-mate.co.uk> wrote in message
news:uQ******** ******@TK2MSFTN GP09.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.Si ze / 1024), "#0.00") & " KB"

or

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

Neither of the above seem to work as below;

Response.Write Format((Fldr.Si ze / 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*****@spammi ngisevil.bad> wrote in message
news:Ou******** ******@tk2msftn gp13.phx.gbl...
"Steven Burn" <nobody@PVT_i t-mate.co.uk> wrote in message
news:uQ******** ******@TK2MSFTN GP09.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.Si ze / 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*****@ielear ning.com> wrote in message
news:eO******** ******@TK2MSFTN GP11.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_i t-mate.co.uk> wrote in message
news:uQ******** ******@TK2MSFTN GP09.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.Si ze / 1024), "#0.00") & " KB"

or

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

Neither of the above seem to work as below;

Response.Write Format((Fldr.Si ze / 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******@NOyah oo.SPAMcom> wrote in message
news:#P******** ******@TK2MSFTN GP12.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((c dbl(florfldr)/1024),0):If FeckIt < 1 then FeckIt
= 1
End Function

Response.Write FeckIt(File.Siz e) & " 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_i t-mate.co.uk> wrote in message
news:uQ******** ******@TK2MSFTN GP09.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.Si ze / 1024), "#0.00") & " KB"

or

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

Neither of the above seem to work as below;

Response.Write Format((Fldr.Si ze / 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1512
by: kevininstructor | last post by:
The following was copied from a web site for learning formatting. Dim myInt As Integer = 100 Dim FormatPrice As String = String.Format("Price = |{0,10:c }|", myInt) Console.WriteLine(FormatPrice) The result shown is no number but the character c as in the format string. Is the format not valid in this context? Thanks for your assistance, Kevin
6
3408
by: Servé Lau | last post by:
suppose I want to use sscanf get the functionname from a function prototype. Is the following format string correct then? char funcname; char *p = "func(void)"; sscanf(p, "%s", funcname); // "%s"
6
2617
by: Donal McWeeney | last post by:
Hi, Is there a way to specify on the predefined format strings like P and N that you want displayed all the decimals in the number... for example 3 will display 3 2.1 will display 2.1 3.21 will display 3.21
2
1583
by: MM | last post by:
Hi, I have a param class containg these vars:- string key; // eg: "WN" object value; // eg: 1.2 string format; // eg "F2" and I output these to a StreamWriter using nc_file.Write("{0}{1:" + param.format + "}", param.key, param.value);
7
7675
by: Eddy Soeparmin | last post by:
Hi, I need to display a DateTime field in 'mm/dd/yyyy' in a DataGrid.. On myGrid1 - Properties - Columns - myColumn1 - Text format string: I tried to put 'mm/dd/yyyy' in there and it displays 'mm/dd/yyyy' in stead of '04/10/2001'. I know I didn't do it right. Please let me know what's the correct way to display a 'mm/dd/yyyy' format for a DateTime coulmn. Thanks.
4
7007
by: James | last post by:
vb.net 2003 i used console.writeline to output to screen. eg console.writeline ("test1 : " & vbtab & v_test1) console.writeline ("test2 : " & vbtab & v_test2) etc etc result becomes
3
12804
by: stathisgotsis | last post by:
Hello everyone, Trusting K&R2 i thought until recently that spaces are ignored in scanf's format string. Reading arguments to the contrary confused me a little. So i now ask: Is scanf("%d%d",...) different from scanf("%d %d",...) in the Standard's point of view? Thank you.
7
5482
by: Tony Girgenti | last post by:
Hello. Trying to develop VS2005, SP1 windows form VB program. When i try a statement like below and the data is "24.95", without the quotes of course, regPriceString equals "000000000025+" . regPriceString = String.Format("{0:000000000000+}", merchandiseDataRow.Item("RegPrice"))
7
9952
by: moondaddy | last post by:
I need to format a string to it always has 2 digits in it. I'm getting the month like this: DateTime.Now.Month.ToString() Right now since it's August, this returns a string of "8", however, I need to return a string of "08". Is there a format method what will automatically pad this for me? Thanks.
7
13695
by: Andrus | last post by:
How to create format string for decimal data type which shows blank for zero and default format otherwize ? I tried format string "f;f;#" but this shows f for nonzero numbers. Andrus. using System.Windows.Forms;
0
10804
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10517
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10226
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9343
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7765
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5631
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4430
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3990
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3086
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.