We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Change number of decimal places

I am using Visual Studio 2017 (Visual Basic). I have added a number of SfNumericTextBox controls to a form but they default to 2 decimal places. How can I change the number of decimal places displayed?



5 Replies

JP Jagadeesan Pichaimuthu Syncfusion Team February 19, 2019 11:28 AM UTC

Hi Barry, 

Thanks for using Syncfusion product. 

You can able to achieve your requirement by using the NumberFormatInfo property of the SfNumericTextBox control. If the FormatMode of the numeric textbox is Numeric then we can set the NumberDecimalDigits value to change the decimal places.  

//If the FormatMode is Numeric 
this.NumericTextBox.FormatMode = Syncfusion.WinForms.Input.Enums.FormatMode.Numeric; 

this.NumericTextBox.NumberFormatInfo = new System.Globalization.NumberFormatInfo() { NumberDecimalDigits = 4 }; 


// If the FormatMode is Currency 
this.CurrencyNumericTextBox.FormatMode = Syncfusion.WinForms.Input.Enums.FormatMode.Currency; 

this. CurrencyNumericTextBox.NumberFormatInfo = new System.Globalization.NumberFormatInfo() { CurrencyDecimalDigits = 4 }; 

// If the FormatMode is Percent 
this.PercentNumericTextBox.FormatMode = Syncfusion.WinForms.Input.Enums.FormatMode.Percent; 
this. PercentNumericTextBox.NumberFormatInfo = new System.Globalization.NumberFormatInfo() { PercentDecimalSeparator = 4 }; 

Please refer the below link to get more information about the formatting support in SfNumericTextBox control. 


Let us know whether this helps also if you need any further assistance on this. 

Regards, 
Jagadeesan 



BA Barry February 20, 2019 10:20 AM UTC

This doesn't appear to be VB code.


JP Jagadeesan Pichaimuthu Syncfusion Team February 20, 2019 10:28 AM UTC

Hi Barry, 

Sorry for the inconvenience caused.  

Now we have provided the VB code for your reference. So please find the VB code below, 

'If the FormatMode is Numeric  
Me.NumericTextBox.FormatMode = Syncfusion.WinForms.Input.Enums.FormatMode.Numeric 

Me.NumericTextBox.NumberFormatInfo = New System.Globalization.NumberFormatInfo() With {.NumberDecimalDigits = 4} 


' If the FormatMode is Currency  
Me.CurrencyNumericTextBox.FormatMode = Syncfusion.WinForms.Input.Enums.FormatMode.Currency 

Me.CurrencyNumericTextBox.NumberFormatInfo = New System.Globalization.NumberFormatInfo() With {.CurrencyDecimalDigits = 4} 

' If the FormatMode is Percent  
Me.PercentNumericTextBox.FormatMode = Syncfusion.WinForms.Input.Enums.FormatMode.Percent 

Me.PercentNumericTextBox.NumberFormatInfo = New System.Globalization.NumberFormatInfo() With {.PercentDecimalSeparator = 4} 

Please refer the below link to get more information about the formatting support in SfNumericTextBox control.  


Let us know whether this helps also if you need any further assistance on this. 

Regards, 
Jagadeesan


BA Barry March 1, 2019 11:23 PM UTC

Thank you for your help. Everything is working great now!!


JP Jagadeesan Pichaimuthu Syncfusion Team March 4, 2019 06:13 AM UTC

Hi Barry, 
 
Thanks for the update. 
 
We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you. 
 
Regards, 
Jagadeesan

Loader.
Live Chat Icon For mobile
Up arrow icon