Getting Started with WinForms Currency TextBox

18 Nov 20183 minutes to read

Assembly deployment

Refer to the control dependencies section to get the list of assemblies or NuGet packages that need 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 at the following link:

How to install NuGet packages

Create a simple application with WinForms Currency TextBox

You can create a Windows Forms application with the WinForms Currency TextBox using the following steps:

Create a project

Create a new Windows Forms project in Visual Studio to display the WinForms Currency TextBox control.

Add control through designer

The WinForms Currency TextBox control can be added to an application by dragging it from the toolbox onto the designer surface. The Syncfusion.Shared.Base assembly reference will be added automatically:

WinForms Currency TextBox control added to the form via the designer

Add control manually in code

To add the control manually, follow the steps below:

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

  2. Add the Syncfusion.Windows.Forms.Tools namespace:

    using Syncfusion.Windows.Forms.Tools;
    Imports Syncfusion.Windows.Forms.Tools
  3. Create a WinForms Currency TextBox instance and add it to the form:

    CurrencyEdit currencyEdit1 = new CurrencyEdit();
    this.Controls.Add(currencyEdit1);
    Dim currencyEdit1 As New CurrencyEdit()
    Me.Controls.Add(currencyEdit1)

WinForms Currency TextBox control shown at runtime

Set the maximum and minimum values

You can set the maximum and minimum value of the currency through the MaxValue and MinValue properties of the WinForms Currency TextBox.

this.currencyTextBox1.MaxValue = 10;
this.currencyTextBox1.MinValue = 5;
Me.currencyTextBox1.MaxValue = 10
Me.currencyTextBox1.MinValue = 5

Set currency symbol

You can define the custom currency symbol using the CurrencySymbol property of the WinForms Currency TextBox.

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

WinForms Currency TextBox showing the custom Euro currency symbol

Number format

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

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}

WinForms Currency TextBox with a custom number format applied