Getting Started with Windows Forms Currency TextBox (CurrencyTextbox)

29 Sep 2020 / 3 minutes to read

Assembly deployment

Refer to the control dependencies section to get the list of assemblies or NuGet package that needs to be added as a reference to use the control in any application.

You can find more details about installing the NuGet packages in a Windows Forms application in the following link:

How to install nuget packages

Create a simple application with CurrencyTextBox

You can create a Windows Forms application with CurrencyTextBox using the following steps:

Create a project

Create a new Windows Forms project in Visual Studio to display the CurrencyTextBox control.

Add control through designer

The CurrencyTextBox control can be added to an application by dragging it from the toolbox to a designer view. The Syncfusion.Shared.Base assembly reference will be added automatically:

CurrencyTextBox control added by designer

Add control manually in code

To add the control manually in C#, follow the given steps:

1. Add the Syncfusion.Shared.Base assembly reference to the project.

2. Include the Syncfusion.Windows.Forms.Tools namespace.

using Syncfusion.Windows.Forms.Tools;
Imports Syncfusion.Windows.Forms.Tools

3. Create a CurrencyTextBox instance, and add it to the window.

CurrencyEdit currencyEdit1 = new CurrencyEdit();
Dim currencyEdit1 As New CurrencyEdit()

CurrencyTextBox control

Set the maximum and minimum values

You can set the maximum and minimum value of the currency by MaxValue and MinValue properties of CurrencyTextBox.


Set currency symbol

You can define the custom currency symbol using the CurrencySymbol property of CurrencyTextBox.

//Setting custom currency symbol 
this.currencyTextBox1.CurrencySymbol = "€";
'Setting custom currency symbol 
Me.currencyTextBox1.CurrencySymbol = "€"

CurrencyTextBox currency symbol

Number format

You can customize the number format using the CurrencyDecimalDigits, CurrencyDecimalSeparator, CurrencyGroupSeparator and CurrencyGroupSizes properties of CurrencyTextBox.

this.currencyTextBox1.DecimalValue = 2132423543;
this.currencyTextBox1.CurrencyDecimalDigits = 3;
this.currencyTextBox1.CurrencyDecimalSeparator = "/";
this.currencyTextBox1.CurrencyGroupSeparator = "*";
this.currencyTextBox1.CurrencyGroupSizes = new int[] { 3 };
Me.currencyTextBox1.DecimalValue = 2132423543
Me.currencyTextBox1.CurrencyDecimalDigits = 3
Me.currencyTextBox1.CurrencyDecimalSeparator = "."
Me.currencyTextBox1.CurrencyGroupSeparator = ","
Me.currencyTextBox1.CurrencyGroupSizes = New Integer() {3}

CurrencyTextBox currency symbol