Articles in this section
Category / Section

How to customize Decimal separator, Digit, Group separator and Group size in DoubleTextBox?

1 min read

In DoubleTextBox, Decimal separator, Decimal Digits, Group separator and Group size can be customized by following below steps.

 

Decimal separator

The decimal separator value can be specified by using the property named “NumberDecimalSeparator”.

 

Decimal Digits

The decimal digit value can be specified by using the property named “NumberDecimalDigits”.

 

GroupSeparator

The group separator can be specified by using the property named “NumberGroupSeparator”.

 

GroupSize

The group size can be specified by using the property named “NumberGroupSizes”.

 

The following code example demonstrates the same.

C#

//To assign decimal seperator character
this.doubleTextBox1.NumberDecimalSeparator = this.textBox2.Text;
 
//To specify the decimal digits.
this.doubleTextBox1.NumberDecimalDigits = Convert.ToInt16(this.integerTextBox3.Text);
 
//To assign the seperator for grouping digits
this.doubleTextBox1.NumberGroupSeparator = this.textBox3.Text;
 
//To specify the Number group sizes.
int x = Convert.ToInt16(this.numericUpDownExt1.Value);
this.doubleTextBox1.NumberGroupSizes = new int[] { x };

 

VB

'To assign decimal seperator character
Me.doubleTextBox1.NumberDecimalSeparator = Me.textBox2.Text
 
'To specify the decimal digits.
Me.doubleTextBox1.NumberDecimalDigits = Convert.ToInt16(Me.integerTextBox3.Text)
 
'To assign the seperator for grouping digits
Me.doubleTextBox1.NumberGroupSeparator = Me.textBox3.Text
 
'To specify the Number group sizes.
Dim x As Integer = Convert.ToInt16(Me.numericUpDownExt1.Value)
Me.doubleTextBox1.NumberGroupSizes = New Integer() { x }

 

Note:
  1. The default value of the NumberDecimalDigits is 2.
  2. The default value of the NumberDecimalSepartor is “.”.
  3. The default value of the NumberGroupSeparator is “,”.
  4. The default value of the NumberGroupSizes is 3.

 

Showing decimal separator

Figure 1: Decimal separator is specified as “@”.

Showing decimal digits

Figure 2: Decimal digits is specified as “5”.

Showing group separator

Figure 3: Group separator is specified as “@”.

Showing group size

Figure 4: Group sizes is specified as “1”.

Sample Links:

 

C#: DoubleTextBox_DecimalValue_C#

VB: DoubleTextBox_DecimalValue_VB

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied