Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
FormatPercent Method

Strings.FormatPercent Method

Returns an expression formatted as a percentage (that is, multiplied by 100) with a trailing % character.

Namespace: Microsoft.VisualBasic
Assembly: Microsoft.VisualBasic (in microsoft.visualbasic.dll)

public static string FormatPercent (
	Object Expression,
	[OptionalAttribute] int NumDigitsAfterDecimal,
	[OptionalAttribute] TriState IncludeLeadingDigit,
	[OptionalAttribute] TriState UseParensForNegativeNumbers,
	[OptionalAttribute] TriState GroupDigits
public static String FormatPercent (
	Object Expression, 
	/** @attribute OptionalAttribute() */ int NumDigitsAfterDecimal, 
	/** @attribute OptionalAttribute() */ TriState IncludeLeadingDigit, 
	/** @attribute OptionalAttribute() */ TriState UseParensForNegativeNumbers, 
	/** @attribute OptionalAttribute() */ TriState GroupDigits
public static function FormatPercent (
	Expression : Object, 
	NumDigitsAfterDecimal : int, 
	IncludeLeadingDigit : TriState, 
	UseParensForNegativeNumbers : TriState, 
	GroupDigits : TriState
) : String
Not applicable.



Required. Expression to be formatted.


Optional. Numeric value indicating how many places to the right of the decimal are displayed. Default value is –1, which indicates that the locale settings are used.


Optional. TriState constant that indicates whether or not a leading zero displays for fractional values. See "Settings" for values.


Optional. TriState constant that indicates whether or not to place negative values within parentheses. See "Settings" for values.


Optional. TriState constant that indicates whether or not numbers are grouped using the group delimiter specified in the locale settings. See "Settings" for values.

Return Value

Returns an expression formatted as a percentage (that is, multiplied by 100) with a trailing % character.

For more detailed information, see the Visual Basic topic FormatPercent Function (Visual Basic).

When one or more optional arguments are omitted, the values for omitted arguments are provided by the locale settings.


All settings information comes from the locale of the application. By default, that will be the locale set in the control panel. However, it may be changed programmatically by using the .NET Framework.

The IncludeLeadingDigit, UseParensForNegativeNumbers, and GroupDigits arguments have the following settings.








The computer's regional settings

This example illustrates the use of the FormatPercent function.

Dim TestNumber As Single = 0.76
' Returns "76.00%".
Dim TestString As String = FormatPercent(TestNumber)

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

© 2015 Microsoft