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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Only positive numbers

Thread ID:

Created:

Updated:

Platform:

Replies:

118730 Apr 5,2015 09:38 AM UTC Aug 8,2016 04:57 AM UTC WinRT 11
loading
Tags: SfNumericTextBox
matrostik
Asked On April 5, 2015 09:38 AM UTC


Hello,

How to setup format that allows only positive numbers?

Thanks

Vijayalakshmi Roopkumar [Syncfusion]
Replied On 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.


matrostik
Replied On 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.

Vijayalakshmi Roopkumar [Syncfusion]
Replied On 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.

matrostik
Replied On 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



Victory Jessie Selvam D [Syncfusion]
Replied On 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

matrostik
Replied On 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.

Victory Jessie Selvam D [Syncfusion]
Replied On 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

vidal
Replied On 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.

Keerthana Jegannathan [Syncfusion]
Replied On 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 


vidal
Replied On August 5, 2016 09:48 PM UTC

It's for me Works thanks.

Keerthana Jegannathan [Syncfusion]
Replied On 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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;