Exclude mask characters

7 posts, 0 answers
  1. Robert
    Robert avatar
    6 posts
    Member since:
    Jun 2009

    Posted 24 Jun 2009 Link to this post

    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
  2. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 30 Jun 2009 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Robert
    Robert avatar
    6 posts
    Member since:
    Jun 2009

    Posted 27 Jul 2009 Link to this post

    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
  5. Arve Asheim
    Arve Asheim avatar
    8 posts
    Member since:
    Jun 2009

    Posted 27 Oct 2011 Link to this post

    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.
  6. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 31 Oct 2011 Link to this post

    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.

  7. Arve Asheim
    Arve Asheim avatar
    8 posts
    Member since:
    Jun 2009

    Posted 23 Nov 2011 Link to this post

    Did this make the Q3 2011 release?
  8. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 25 Nov 2011 Link to this post

    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.

Back to Top
UI for WinForms is Visual Studio 2017 Ready