473,624 Members | 2,575 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

fixed point decimal

I am doing calculations on numbers and then I want to display them in a datagrid that always has 2 decimal places. I am doing something like

Dim Size As Decimal
Dim Space As Decimal
...
...
...
Size = Decimal.Round(S ize, 2)
Space = Decimal.Round(S pace, 2)

If the number happens to round to say 95 I want it to display as 95.00. How can I do that?

Thanks in advance.
Christel
Nov 22 '05 #1
1 1505
Hi Christel,

Take a look at Binding.Format Event.

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"Christel" <an*******@disc ussions.microso ft.com> wrote in message
news:9B******** *************** ***********@mic rosoft.com...
I am doing calculations on numbers and then I want to display them in a datagrid that always has 2 decimal places. I am doing something like
Dim Size As Decimal
Dim Space As Decimal
.
.
.
Size = Decimal.Round(S ize, 2)
Space = Decimal.Round(S pace, 2)

If the number happens to round to say 95 I want it to display as 95.00. How can I do that?
Thanks in advance.
Christel

Nov 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

26
9670
by: Adrian Parker | last post by:
I'm using the code below in my project. When I print all of these fixed length string variables, one per line, they strings in questions do not properly pad with 0s. strQuantity prints as " 4". Six spaces than the value of intQuantity. This is correct. But all the others end up being string objects of only 6 characters long (with the exception of strTotal). The left most positions of the string object are being padded with one...
5
6763
by: Abe Simpson | last post by:
Hello all, The application I am working on must never output numbers in a floating-point format, that is, something like 2e-002 is a big no-no. At the same time, it must output numbers in a compact way, that is, it should only output significant digits, and only output a decimal point if there are digits following it.
4
7838
by: Roger Leigh | last post by:
Hello, I'm writing a fixed-precision floating point class, based on the ideas in the example fixed_pt class in the "Practical C++ Programming" book by Steve Oualline (O' Reilly). This uses a long int to store the value, and the precision (number of decimal points) is variable (it's a templated class): template <size_t _decimal_places = 4> class FixedFloat {
1
321
by: Christel | last post by:
I am doing calculations on numbers and then I want to display them in a datagrid that always has 2 decimal places. I am doing something like Dim Size As Decimal Dim Space As Decimal ... ... ... Size = Decimal.Round(Size, 2) Space = Decimal.Round(Space, 2)
1
15470
by: Mike MacSween | last post by:
This looks like a bug to me. I have an expression on a report: =Format(Sum((**)*(/)),"0.00") Score is byte PercentOfGrade is double PropDegree is single ModuleCats is byte
10
3204
by: August Derleth | last post by:
Cause I made such a hash of my first attempt, and in an effort to provide PORTABLE code to solve the problem, I submit this solution to convert to and from BCD values stored in longs. This should work just as well for ints and (in theory) chars and, indeed, any integral type. If it doesn't, suggest ways to improve it, even at a significant speed/code size penalty. #include <math.h> long bcd(long decimal) {
9
4181
by: pout | last post by:
What are the purposes of fixed-point? When should it be used? I read: #define Int2Fixed(x) (((long)(short)x) << 16) and the fixed-point in 16.16 format. Does the 16 in the MACRO refer to integer or decimal part? For example, if in 8.24, should the macro be: #define Int2Fixed(x) (((long)(short)x) << 24)?
3
2220
by: Xavier Wargny | last post by:
Hi all and each! Since july, I'm working with dot NET technology. Confident with brand new tools it gave, I decided to use that new decimal type (related with the Database type...). After many 'plantages' (critical stops?) in the communication between my Calculation serveur and my Interface server, I discovered a problem with the serialization of decimals, because some values I use are below the Critical Number 0.0001m (I should blame...
2
1885
by: Rob Clewley | last post by:
Dear Pythonistas, How many times have we seen posts recently along the lines of "why is it that 0.1 appears as 0.10000000000000001 in python?" that lead to posters being sent to the definition of the IEEE 754 standard and the decimal.py module? I am teaching an introductory numerical analysis class this fall, and I realized that the best way to teach this stuff is to be able to play with the representations directly, in particular to be...
0
8179
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8348
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6112
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
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4084
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...
0
4187
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2613
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
1
1797
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1493
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.