RadMaskedEditBox and Negative Numbers

2 posts, 0 answers
  1. Chet Musialowski
    Chet Musialowski avatar
    19 posts
    Member since:
    Nov 2009

    Posted 21 Mar 2012 Link to this post


    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 ?

  2. Stefan
    Stefan avatar
    2906 posts

    Posted 26 Mar 2012 Link to this post

    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.

    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Back to Top