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

Exclude mask characters

6 Answers 287 Views
MaskedEditBox
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 24 Jun 2009, 03:40 PM
Hi All,

I need to exclude the mask characters from my MaskedEditBox.  Using MS's MaskedTextBox, the code to do this is:

myMaskedTextBox.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals;

Does anyone know of the equivalent?

Robert

6 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 30 Jun 2009, 07:14 AM
Hi Robert,

We do not have this functionality in our RadMaskedEditBox. However, you can modify the PlaceHolder property which defines the character shown in the edit field instead of the mask characters. By default, the value of this property is "_" and you can set it to a single empty space. We will consider adding the desired functionality in the future releases.

Best wishes,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Robert
Top achievements
Rank 1
answered on 27 Jul 2009, 08:27 PM
Hi Nikolay,

I found a solution to my problem.  Ultimately, what I was after was the ability to write just the input value to the database, rather than the value + input mask characters (i.e. for a phone number, store only "1234567890" instead of "(123) 456-7890").

Originally, I was using the .Text property, but, after switching to the .Value property, I am now receiving the desired results.

Thanks for your assistance.

Robert
0
Martin Lundgard
Top achievements
Rank 2
answered on 27 Oct 2011, 12:17 PM
Did you actually get this to work?
I'm binding on the .Value field, and still get the literals using the latest dll-s.
My mask is for the personal norwegian id, mask = "00-00-00-00000", MaskType = Numeric.
I only want the digits typed in the .Value field.
0
Peter
Telerik team
answered on 31 Oct 2011, 10:01 AM
Hello Arve,

We will provide in our next release a property named TextMaskFormat that manages the literals in the Value property.

For your version Nikolay's workaround is not suitable.

I would suggest that you wait for the new assemlies or to inherit MaskedEditBox and override the Value property in order to remove literal symbols. Please refer to the code below:

Public Class MyMaskeditBox
       Inherits RadMaskedEditBox
       Public Property Value() As Object
           Get
               If Me.Mask.StartsWith("p") Then
                   Return DirectCast(MyBase.Value * 100, Integer)
               Else
                   Dim stringValue As String = DirectCast(MyBase.Value, String)
                   stringValue = stringValue.Replace("-", "").Replace(" ", "")
                   Return stringValue
               End If
           End Get
           Set(ByVal value)
               If Me.Mask.StartsWith("p") Then
                   MyBase.Value = value / 100
               Else
                   MyBase.Value = value
               End If
           End Set
       End Property
   End Class

I hope this helps. All the best,
Peter
the Telerik team

Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

0
Martin Lundgard
Top achievements
Rank 2
answered on 23 Nov 2011, 11:09 AM
Did this make the Q3 2011 release?
0
Peter
Telerik team
answered on 25 Nov 2011, 05:52 PM
Hi Arve,

In Q3 2011 release we provided a property named TextMaskFormat that manages the literals of the Value property.

All the best,

Peter
the Telerik team

Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

Tags
MaskedEditBox
Asked by
Robert
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Robert
Top achievements
Rank 1
Martin Lundgard
Top achievements
Rank 2
Peter
Telerik team
Share this question
or