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

MaskedEdit - Need Simple Numeric Example (allow int values 1 - 999)

5 Answers 189 Views
MaskedEditBox
This is a migrated thread and some comments may be shown as answers.
Gone2TheDogs
Top achievements
Rank 1
Iron
Veteran
Gone2TheDogs asked on 28 Oct 2016, 12:58 PM

Please let me know where I am going wrong!

I've tried many ways, but for some reason when I test my maskedit field, I can't type anything in. No values are displayed as I type and the IFrame cursor doesn't move as I type. I can only Tab off the field.

Input:  1 - 999

-----------------------------

Mask:  nnn

Type: Numeric

Prompt Char: 0

---------------------------

On line 7 below, the field doesn't get set to "001"

01.Private Sub mtxtDaysElapsed_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles mtxtDaysElapsed.Validating
02.    'between 1 and 999 exclusive
03.    Dim nDaysElapsed = 0
04. 
05.    Try
06.        If mtxtDaysElapsed.Value = "" Or mtxtDaysElapsed.Value = "0" Then
07.            mtxtDaysElapsed.Value = "001"
08.        End If
09.        If Integer.TryParse(mtxtDaysElapsed.Value, nDaysElapsed) Then
10.            recPoVenmst.LateCutoffDays = nDaysElapsed.ToString
11.        Else
12.            e.Cancel = True
13.        End If
14.    Catch ex As Exception
15.        'error
16.    End Try
17.End Sub

5 Answers, 1 is accepted

Sort by
0
Gone2TheDogs
Top achievements
Rank 1
Iron
Veteran
answered on 28 Oct 2016, 02:00 PM
I swapped out the MaskedEdit control for a SpinEdit. In this case, it works well. However, I would like to know why I'm not able to use the Numeric mask type with the way I have it set up.
0
Gone2TheDogs
Top achievements
Rank 1
Iron
Veteran
answered on 28 Oct 2016, 02:35 PM

I'm getting the same issue when I try anything with a Numeric mask type. The IFrame cursor doesn't move as I type in the field, when I enter valid characters.

Here is an example that I tried:

Culture: en-us

Mask:  #0.00

MaskType:  Numeric

 

What is causing this issue where I can't type in a value?

 

0
Dimitar
Telerik team
answered on 31 Oct 2016, 09:46 AM
Hi Bob,

Thank you for writing.

The numeric mask can be used for general number formatting. For example, you can set the mask to "N2" and you will be able to add type a number. You should choose a standard number format string: Standard Numeric Format Strings.

This MaskType is not suitable when you want to restrict the user to enter a number with a specific length. For this you can use a standard mask:
radMaskedEditBox1.MaskType = MaskType.Standard;
radMaskedEditBox1.Mask = "###";

I hope this will be useful. Let me know if you have additional questions.

Regards,
Dimitar
Telerik by Progress
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
0
Ceki Granti
Top achievements
Rank 1
answered on 02 Nov 2016, 07:13 AM

Dear Dimitar,

I'm facing the same issue and realized that if you bind the MaskedEditBox to a null value you can not type anything in..

Please test below code (StockTypeId should be Null value)..

ps: If you test the same code with StockTypeId as an other than a null value, you will be able to write in...

radMaskedEditBox1.MaskType = Telerik.WinControls.UI.MaskType.Numeric
radMaskedEditBox1.Mask = "N1"
radMaskedEditBox1.DataBindings.Add("Value", somedatasource, "StockTypeId")

0
Dimitar
Telerik team
answered on 03 Nov 2016, 08:35 AM
Hello ,

I was able to reproduce this and indeed this is an issue introduced with the latest version of the controls (it is caused by a fix for another issue). The issue is already logged in our portal. Here are the details: UI for Winforms Feedback Portal - FIX.RadMaskedEditBox - the user is not allowed to enter a numeric value if the initial value is null is simple data binding is used.

New version release is planned for 16 November and the fix will be available in it.  

Should you have any other questions do not hesitate to ask.

Regards,
Dimitar
Telerik by Progress
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
Tags
MaskedEditBox
Asked by
Gone2TheDogs
Top achievements
Rank 1
Iron
Veteran
Answers by
Gone2TheDogs
Top achievements
Rank 1
Iron
Veteran
Dimitar
Telerik team
Ceki Granti
Top achievements
Rank 1
Share this question
or