This is a migrated thread and some comments may be shown as answers.
A small bug in RadMaskedEditBox
5 Answers 9 Views
This is a migrated thread and some comments may be shown as answers.
Mando
Top achievements
Rank 1
Mando asked on 05 Apr 2016, 01:33 PM

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

5 Answers, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 08 Apr 2016, 07:19 AM
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.
0
Mando
Top achievements
Rank 1
answered on 09 May 2016, 02:13 PM

Hello Victor,

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

Please move it to UI WinForms section

0
Hristo
Telerik team
answered on 12 May 2016, 09:01 AM
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.
 
0
Mando
Top achievements
Rank 1
answered on 12 May 2016, 12:00 PM

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

0
Hristo
Telerik team
answered on 12 May 2016, 02:11 PM
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.
Asked by
Mando
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Mando
Top achievements
Rank 1
Hristo
Telerik team
Share this question
or