A small bug in RadMaskedEditBox

Thread is closed for posting
6 posts, 0 answers
  1. Mando
    Mando avatar
    8 posts
    Member since:
    Apr 2009

    Posted 05 Apr Link to this post

    Hello,

    there is an issue with the mentioned control which case the application to be terminated

    To get the error please do the below:

    1- Set Culture Property to any Arabic (Ex: ar-EG)

    2- Set Mask to "c"

    3- Set MaskType to Numeric

    4- Run your windows application.

    5- Select all the content of the RadMaskedEditBox

    6- Start Type any number

    You will get an error message and the application will be closed, this issue exists in the Demos which comes with the installation package

  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 08 Apr Link to this post

    Hello Mando,

    I was not able to replicate the behavior you describe. Would you try to replicate the issue in one of the online examples listed below?


    Alternatively, you can send us sample project or code snippets where the issue is replicated. This way we can examine the behavior and look for its cause.

    On a side note, have in mind that the RadMaskedTextBox control does not have a MaskType property. Are you referring to a different control?

    Regards,
    Viktor Tachev
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mando
    Mando avatar
    8 posts
    Member since:
    Apr 2009

    Posted 09 May Link to this post

    Hello Victor,

    sorry I posted in the wrong place, I'm talking about winforms control

    Please move it to UI WinForms section

  5. Hristo Merdjanov
    Admin
    Hristo Merdjanov avatar
    710 posts

    Posted 12 May Link to this post

    Hi Mando,

    Thank you for writing.

    I managed to reproduce the exception and I have  logged it in our feedback portal. You can track its progress, subscribe for status changes and add your vote/comment to it on the following link - feedback item. I have also updated your Telerik points.

    Until we release a permanent fix please use the following workaround:
    public Form1()
    {
        InitializeComponent();
     
        this.radMaskedEditBox1.Culture = new CultureInfo("ar-EG");
        this.radMaskedEditBox1.Mask = "c";
        this.radMaskedEditBox1.MaskType = Telerik.WinControls.UI.MaskType.Numeric;
     
        this.radMaskedEditBox1.KeyDown += radMaskedEditBox1_KeyDown;
    }
     
    private void radMaskedEditBox1_KeyDown(object sender, KeyEventArgs e)
    {
        if (this.radMaskedEditBox1.SelectionLength == this.radMaskedEditBox1.Text.Length)
        {
            this.radMaskedEditBox1.SelectionLength = 0;
        }
    }

    I hope this helps. Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo Merdjanov
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
     
  6. Mando
    Mando avatar
    8 posts
    Member since:
    Apr 2009

    Posted 12 May Link to this post

    Hi Hristo, Thanks for your workaround 

    I tested the control using your code and I got the below results:

    1- if you typed a couple of numbers then selected all text of the radMaskEditBox then typed again it will add the text to the current

    2- if you selected the currency mark which is "ج.م." for Egyptian currency you will get an error and the application will be terminated.

    however I worked on it and the below code works fine with me:

    private void radMaskedEditBox1_KeyPress(object sender, KeyPressEventArgs e)
    {
        if (char.IsDigit(e.KeyChar))
        {
            if (radMaskedEditBox1.SelectedText.Trim() == "ج.م.‏") // Remove this condition if you want the box to accept the numbers while you are selecting the currency mark
                e.Handled = true;
            else
            {
                if (this.radMaskedEditBox1.SelectionLength == this.radMaskedEditBox1.Text.Length)
                {
                    this.radMaskedEditBox1.SelectionLength = 0;
                    radMaskedEditBox1.Text = "00";
                }
                if (radMaskedEditBox1.SelectedText.StartsWith("ج.م."))
                    radMaskedEditBox1.SelectedText = "ج.م." + radMaskedEditBox1.SelectedText.Remove(0, 4);
            }
        }
        else
            e.Handled = true;
    }

    I hope this hepls, Please send me a notification when you have any update for the mentioned control

    Regards

  7. Hristo Merdjanov
    Admin
    Hristo Merdjanov avatar
    710 posts

    Posted 12 May Link to this post

    Hello Mando,

    I am glad that you have managed to achieve a result which fits your setup. Thank you for sharing it with our community.

    Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo Merdjanov
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017