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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

? about Expression 1

Status
Not open for further replies.

access97to2000

Programmer
Aug 12, 2002
45
US
Hi,
I have a huge number like "200047034880"
i want the output as 186.31 GB
so in the expression i gave as
=((fields.value)/(1024*1024*1024) ) & " GB"
and in the properties i made the format as Number - 1234.00 mode.
The problem is
if i give & " GB" the out put is not formatted and i get
186.30458297493749843 GB.

?But i want it as 186.31 GB. Please let me know the procedure.
 
Not 100% sure which function is available to .NET but the general pricipal is to format the number as text to a fixed no. of digits and THEN add the " GB"

In excel I would use

=TEXT(((fields.value)/(1024*1024*1024)),"0.00") & " GB"

In VBA I would use

cstr(Format(((fields.value)/(1024*1024*1024)),"0.00") & " GB")

Rgds, Geoff

A file that big? It might be very useful. But now it is gone

Please read FAQ222-2244 before you ask a question
 
Just put the GB in the format. So your Value property would still be: =((fields.value)/(1024*1024*1024))

And your format property for your textbox would be: #.00 GB
 
I forgot to mention in the above tip that you will have to use custom formatting, not the pre-packaged formats that you can select (ie. 1234.00).
 
Thank you for the replies -
But can you please tell me how can i do the custom formating?
 
Two ways:

1) Right click the text box or cell and select Properties from the context menu. You should see the Format area on the right side of the window (the place where you selected the Number - 1234.00 format). Underneath that you see a radio button for "Custom". Check that and enter #.00 GB.

2) Just look at the properties explorer toolbar (default on the right side of the .NET IDE), and scroll down to Format. Then just type in #.00 GB.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top