Only positive numbers
11 Replies
VR
Vijayalakshmi Roopkumar
Syncfusion Team
April 6, 2015 01:17 PM UTC
Hi Ros,
Thank you for contacting the Syncfusion Support,
A support incident has been created under your account to track the details for the reported query in this forum . Please log on to our support website to check for further updates:
Link: https://www.syncfusion.com/support/directtrac/incidents/137495
Please let me know if you have any questions.
Regards,
Vijayalakshmi V.R.
MA
matrostik
April 13, 2015 07:27 AM UTC
Hi,
thanks for answer.
I have other problem , when i am trying use 'D' as FormatString i got an error.
VR
Vijayalakshmi Roopkumar
Syncfusion Team
April 14, 2015 03:12 PM UTC
Hi Ros,
The FormatString "D" is for the DateTime format. In our SfNumericTextBox, it allows only the format of Numeric type like Number, Percentage, Currency, Double values and does not allow the DateTime Format. So, the FormatString "D" is an invalid FormatString usage with the SfNumericTextBox.
Please let us know if you have any other concerns,
Regards,
Vijayalakshmi V.R.
The FormatString "D" is for the DateTime format. In our SfNumericTextBox, it allows only the format of Numeric type like Number, Percentage, Currency, Double values and does not allow the DateTime Format. So, the FormatString "D" is an invalid FormatString usage with the SfNumericTextBox.
Please let us know if you have any other concerns,
Regards,
Vijayalakshmi V.R.
MA
matrostik
April 14, 2015 03:17 PM UTC
In the tutorial you have reference to the standart numeric format strings and 'D' format is for Decimal link
So how can i setup format for Integer digits with optional negative sign?
Thanks
VJ
Victory Jessie Selvam D
Syncfusion Team
April 15, 2015 11:13 AM UTC
Hi Ros,
Query #1: In the tutorial you have reference to the standard numeric format strings and 'D' format is for decimal link
SfNumericTextBox parses the value using decimal.ToString(String,IFormatProvider) and double.ToString(String,IFormatProvider) methods for Decimal and Double parsing modes respectively. decimal.ToString(format,NumberFormat) will not accept D,X & R values and double.ToString(format,NumberFormat) will not accept D & X values in standard numeric formats as format parameter. So it throws format exception while setting the string "D". Please refer the following Microsoft msdn links,
https://msdn.microsoft.com/en-us/library/kfsatb94(v=vs.110).aspx
https://msdn.microsoft.com/en-us/library/fzeeb5cd(v=vs.110).aspx
Query #2: So how can i setup format for integer digits with optional negative sign?
We have prepared a sample to format value as integer digits with optional negative sign by setting FormatString="N0" and MaximumNumberDecimalDigits="0". FormatString N0 indicates that it accepts numeric value and works similar to numeric format string D. Setting MaximumNumberDecimalDigits=0 will restrict decimal digits on lost focus(else ".00" will appear based on Culture.NumberFormat.NumberDecimalDigits). Optional negative sign is accepted by default so you can enter negative sign when required. Kindly download the sample from following link,
Sample: DecimalNegative.zip
Please let us know whether the provided sample meets your requirement or not.
Regards,
Jessie
Query #1: In the tutorial you have reference to the standard numeric format strings and 'D' format is for decimal link
SfNumericTextBox parses the value using decimal.ToString(String,IFormatProvider) and double.ToString(String,IFormatProvider) methods for Decimal and Double parsing modes respectively. decimal.ToString(format,NumberFormat) will not accept D,X & R values and double.ToString(format,NumberFormat) will not accept D & X values in standard numeric formats as format parameter. So it throws format exception while setting the string "D". Please refer the following Microsoft msdn links,
https://msdn.microsoft.com/en-us/library/kfsatb94(v=vs.110).aspx
https://msdn.microsoft.com/en-us/library/fzeeb5cd(v=vs.110).aspx
Query #2: So how can i setup format for integer digits with optional negative sign?
We have prepared a sample to format value as integer digits with optional negative sign by setting FormatString="N0" and MaximumNumberDecimalDigits="0". FormatString N0 indicates that it accepts numeric value and works similar to numeric format string D. Setting MaximumNumberDecimalDigits=0 will restrict decimal digits on lost focus(else ".00" will appear based on Culture.NumberFormat.NumberDecimalDigits). Optional negative sign is accepted by default so you can enter negative sign when required. Kindly download the sample from following link,
Sample: DecimalNegative.zip
Please let us know whether the provided sample meets your requirement or not.
Regards,
Jessie
MA
matrostik
April 15, 2015 04:02 PM UTC
Thanks,
But the problem that i need to put some zeros at the beginning of the number if it too short.
VJ
Victory Jessie Selvam D
Syncfusion Team
April 16, 2015 07:11 AM UTC
Hi Ros,
The requirement for adding leading zeros is possible only with string values. Double value cannot have leading zeros and SfNumericTextBox always parses the Text to double value(while typing and focus changes). So we cannot display zeros before number even if the Text is formatted(double.Parse method will remove it). Please refer the following msdn forum link,
https://social.msdn.microsoft.com/Forums/vstudio/en-US/dad3330a-0d8d-4815-bbc3-b6f05d6b8b05/how-to-add-zero-to-an-integer-value-from-left-like-999-to-0999?forum=csharpgeneral
Please let us know if you need further assistance on this.
Regards,
Jessie
The requirement for adding leading zeros is possible only with string values. Double value cannot have leading zeros and SfNumericTextBox always parses the Text to double value(while typing and focus changes). So we cannot display zeros before number even if the Text is formatted(double.Parse method will remove it). Please refer the following msdn forum link,
https://social.msdn.microsoft.com/Forums/vstudio/en-US/dad3330a-0d8d-4815-bbc3-b6f05d6b8b05/how-to-add-zero-to-an-integer-value-from-left-like-999-to-0999?forum=csharpgeneral
Please let us know if you need further assistance on this.
Regards,
Jessie
VI
vidal
August 2, 2016 01:59 PM UTC
Hi i have a SfNumericTextBox on Xaml proyect to write the zip code on it, i add the property MaximumNumberDecimalDigits="0" but when the focus change the zip code is 1425.00 i want to do this 1425.
KJ
Keerthana Jegannathan
Syncfusion Team
August 3, 2016 12:02 PM UTC
Hi Ros,
If your requirement is to use whole number in SFNumericTextBox, then it can be achieved by setting the FormatString to “N0”(N and zero) . Please refer the below code example and sample.
Code Example:
|
<Input:SfNumericTextBox x:Name="sfNumericTextBox" Value="123" FormatString="N0"/> |
Sample: NumericTextBoxSample
Please let us know if it meets your requirement.
Regards,
Keerthana J
VI
vidal
August 5, 2016 09:48 PM UTC
It's for me Works thanks.
KJ
Keerthana Jegannathan
Syncfusion Team
August 8, 2016 04:57 AM UTC
Hi Ros,
Thank you for your update.
We are glad that we helped in achieving your requirement. Please let us know if you need further assistance.
Regards,
Keerthana J
SIGN IN To post a reply.
- 11 Replies
- 5 Participants
-
MA matrostik
- Apr 5, 2015 09:38 AM UTC
- Aug 8, 2016 04:57 AM UTC