This is a migrated thread and some comments may be shown as answers.

RadMaskedEditBox and Negative Numbers

1 Answer 188 Views
MaskedEditBox
This is a migrated thread and some comments may be shown as answers.
Chet Musialowski
Top achievements
Rank 1
Chet Musialowski asked on 21 Mar 2012, 10:02 PM
Hello,

I am using version 2012.1.301.20 of the WinForms controls.

I have a currency value that is negative and using the mask C2.  I want to get back just the number without the commas and dollar sign, however when I set the TextMaskFormat, I cannot get what I want.

I entered -1234.56 into the text box and this is what I get for Value & Text for each TextMaskFormat value:

Value 1 is 1234.56 and the Text is -$1,234.56 and TextMaskFormat is ExcludePromptAndLiterals
Value 2 is 1234.56 and the Text is -$1,234.56 and TextMaskFormat is IncludePrompt
Value 3 is -$1,234.56 and the Text is -$1,234.56 and TextMaskFormat is IncludeLiterals
Value 4 is -$1,234.56 and the Text is -$1,234.56 and TextMaskFormat is IncludePromptAndLiterals

Shouldn't ExcludePromptAndLiterals and IncludePrompt given me the Value -1234.56 ?

Thanks,
Chet

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 26 Mar 2012, 02:48 PM
Hello Chet,

Thank you for writing.

Indeed, I can confirm that the minus sign should remain with all text formats. I have logged this issue in PITS and we will address it accordingly. Here is a link, where you can add your vote for it: http://www.telerik.com/support/pits.aspx#/public/winforms/10449.

I have updated your Telerik points for this report.

For the time being, you can manually remove the dollar sign and the thousands separator to get the desired value:
string value =radMaskedEditBox1.Value.ToString().Replace("$", "").Replace(",", "");
radLabel1.Text = value;

I hope that you find this information useful. 

Should you have any other questions or suggestions, do not hesitate to contact us.

Regards,
Stefan
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Tags
MaskedEditBox
Asked by
Chet Musialowski
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or