VB (.NET) provides FormatNumber function that can be used to format numbers. The general form of the format number is FormatNumber(Exp_num[, NumDigitsAfterDecimalPlace[,LeadingZero[,UseParforNegative[,UseSeparator]]]]).
-Exp_num: it is the number to be formatted.
-NumDigitsAfterDecimalPlace (optional): it is the number of digits to display after decimal point.
-LeandingZero (optional): This argument takes TriState.True or TriState.False value. If you specify TriState.True, the 0 digit is placed before decimal point to the number that is between 0.00 and and 1.00.
-UseParforNegative (optional): This argument takes TriState.True or TriState.False value. If it takes TriState.True, the negative number is place between parentheses.
-UseSeparator (option): This argument takes TriState.True or TriState.False value. If you want to display thousand separator (,) , use TriState.True.
Dim value As Double = -83992.97752
Dim val = FormatNumber(value, 3, TriState.True, TriState.True, TriState.True)
Posted by: Dara | post date: 02-10-2013 | Subject: VB.NET Programming Language
This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages: