Rechercher : dans
Par :

[VB.NET] Arrondi 2 décimales

Dernière réponse le 12 avr 2008 à 20:07:09 Sandriine, le 12 avr 2008 à 19:43:21 
 Signaler ce message aux modérateurs

Bonjour,
j'ai un nombre décimal que je voudrais arrondir à 2 chiffres après la virgule en VB.NET.

Je suppose qu'il y a une fonction faite pour cela?

Configuration: Windows XP
Firefox 2.0.0.13

1

 Enax, le 12 avr 2008 à 20:07:09
  • +2

http://msconline.maconstate.edu/tutorials/VBNET/VBNET01/vbne­t01-08.aspx

The FormatNumber() function returns a value formatted as a number. Its general format is shown below.

FormatNumber(value [, trailing digits] [, leading digit] [, parentheses] [, group digits])

value is any expression that produces a number;
trailing digits is an integer giving the number of digits following the decimal point; the default is rounding to 2 digits;
leading digit is True or False to indication whether a leading 0 is to appear before the decimal point for fractional values;
parentheses is True or False to indicate whether negative numbers should be displayed inside parentheses;
group digits is True or False to indicate whether numbers should be grouped between commas.

Répondre à Enax
Collection CommentÇaMarche.net