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

RadMaskedEditBox - standard maskType, Mask = "aaaaa", unexpected behavior

10 Answers 117 Views
MaskedEditBox
This is a migrated thread and some comments may be shown as answers.
Catalin
Top achievements
Rank 1
Veteran
Catalin asked on 29 Nov 2013, 08:28 AM
Hi all,

I’m trying to simulate the MaxLength property (which is no longer available) on a RadMaskEditBox and I use:
radMaskedEditBox1.MaskType = MaskType.Standard; 
radMaskedEditBox1.Mask = “aaaaa”;

I set programmatically a first value in my RadMaskedEditBox1, “ABCDE”. The displayed value on my control is, as expected, “ABCDE”. 

Then I try to set another value, "XX”, and I notice that de displayed value of the control is “XXCDE”.

Any idea? How can I use masks to limit the chars n° in the RadMaskEditBox?
Thank you


L.E.: RadControls version 2013.3.1127.40

10 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 03 Dec 2013, 04:10 PM
Hi Catalin,

Thank you for writing.

When you have initialized the mask like this you cannot enter more than five letters (your length is limited to 5 letters). Then also when you are setting the text like this it will only change the first two letters. To clear the remaining letters you can either clear the entire box or to set some spaces after the desired text:
radMaskedEditBox1.Text = new string(' ', radMaskedEditBox1.Text.Length);
radMaskedEditBox1.Text = "XX   ";

I hope this will be useful. Should you have further questions, I would be glad to help.

Regards,
Dimitar
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Catalin
Top achievements
Rank 1
Veteran
answered on 04 Dec 2013, 02:14 PM
Thank You, Dimitar, 

This might be a solution, but I think the mask "aaaaa" means "5 alphanumeric optional char".
Adding some trailing characters just to erase the MaskedEditBox's content it's not coherent...

Thanks again, I'll try to use your solution.

Best regards,
Catalin
0
Dimitar
Telerik team
answered on 09 Dec 2013, 12:10 PM
Hi Catalin,

Thank you for writing back.

This is how RadMaskedEditBox is working (every character is validated or changed separately) and this is the default behavior by design. 

Do not hesitate to contact us if you have other questions.

Regards,
Dimitar
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Fahmi
Top achievements
Rank 1
Veteran
answered on 08 Oct 2020, 09:16 PM

Hi,

I want to Implement the validation provider for a required field.

I think we need the RadMaskedEditBox ?

How can I set the RadMaskedEditBox to allow any alpha numeric data ( at least one caracter : so as a required field) ,in order to integrate this with the validation Provider ?

( For Telerik Winfoms 2020 C# )

Thanks,

Fahmi

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 09 Oct 2020, 12:00 PM
Hello, Fahmi,  

RadMaskedEditBox is a suitable control if you want to restrict the users' input. You can find listed all mask types in the following help article: https://docs.telerik.com/devtools/winforms/controls/editors/maskededitbox/mask-types-and-providers   

For the Standard mask type you can specify very precisely what characters are allowed: https://docs.telerik.com/devtools/winforms/controls/editors/maskededitbox/standard-masks 

If none of the built-in mask types are suitable for your case, RadValidationProvider offers an alternative approach for validating users' data of any control that you have on the form: RadTextBox, RadSpinEditor, etc. 
The following resources are quite useful about getting started experience with the component:
https://docs.telerik.com/devtools/winforms/controls/validation-provider/overview 
https://docs.telerik.com/devtools/winforms/controls/validation-provider/getting-started 
https://www.telerik.com/blogs/ensuring-data-validity-winforms-applications-without-writing-code   
 
I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

0
Fahmi
Top achievements
Rank 1
Veteran
answered on 09 Oct 2020, 07:14 PM

Thanks Dess, this should cover all my requests/needs for now.

Have a nice weekend.

0
Fahmi
Top achievements
Rank 1
Veteran
answered on 10 Oct 2020, 11:33 AM

Hi Dess,

I've implemented this, but it's generating an error on validation (  Object reference not set to an instance of an object ) 

The first validation rules works perfectly, but the rule for : Integer grater then 0 is apparently causing an issue.

Also, I've a validation for a picture to be selected ( picture box ) : I make a test on the generated Path: can this be integrated in the validation Provider in order to display the Icon "Image required" if the path is empty. 
Please note that Path is a variable in code behind and not a RadTextBox.
Thanks,

Fahmi

0
Fahmi
Top achievements
Rank 1
Veteran
answered on 10 Oct 2020, 12:11 PM
Please note that I want to implement this on a RadTextBox and not a RadSpinner as the validation works on RadSpinner.
0
Fahmi
Top achievements
Rank 1
Veteran
answered on 10 Oct 2020, 01:51 PM

Also the RadSpinEditor behaves abnormally when a validation rule is attached: you can't delete easily the input and typing is right to left also last number can be deleted. In addition, you can deleted only with the "delete" keyboard key and not using the "back" keyboard key. 

I hope this is a configuration issue and I don't have to wait until next release to be fixed.

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 12 Oct 2020, 11:04 AM

Hello, Fahmi,   

It seems that you want to validate a RadTextBox with RadValidationProvider. Please have in mind that RadTextBox offers Text property that stores the text. RadTextBox doesn't provide Value property. Hence, the validation rule doesn't seem to be correctly defined. You should be careful about what properties a certain control has and what is the data type of the respective property. This way the validation rule will be properly defined. 

More information about the different validation rules is available here: https://docs.telerik.com/devtools/winforms/controls/validation-provider/validation-rules 

According to the provided information, it wouldn't be easy to understand the complete scenario and the exact setup that you have on your end. That is why I would kindly ask you to submit a support ticket from your Telerik account if you have any technical inquiries about the controls in the Telerik UI for WinForms suite. Thus, you can provide a sample project demonstrating the undesired behavior that you are facing. In addition, your ticket will be entitled to response time according to the license support plan and Telerik support engineers would gladly assist you.  

Thank you for your understanding.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

Tags
MaskedEditBox
Asked by
Catalin
Top achievements
Rank 1
Veteran
Answers by
Dimitar
Telerik team
Catalin
Top achievements
Rank 1
Veteran
Fahmi
Top achievements
Rank 1
Veteran
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or