Xceed Grid for WinForms v4.3 Documentation
Welcome to Xceed Grid for WinForms v4.3 / Advanced Concepts / Editors - Advanced Concepts / Adding mask characters / CustomTextBoxArea class VB.NET implementation
In This Topic
    CustomTextBoxArea class VB.NET implementation
    In This Topic

    The following code provides the VB.NET implementation of the CustomTextBoxArea class.

    VB.NET Copy Code

    Imports System
    Imports Xceed.Editors 

    Namespace Xceed.Editors.Samples
      Public Class CustomTextBoxArea
        Inherits TextBoxArea 

    Public Sub New( ByVal textBox As WinTextBox )
      MyBase.New( textBox )
    End Sub 

    Protected Overrides ReadOnly Property MaskChars() As Char()
      Get
        Dim chars( MyBase.MaskChars.Length + 1 ) As Char
        MyBase.MaskChars.CopyTo( chars, 0 )
        chars( MyBase.MaskChars.Length ) = "$"c 

        Return chars
      End Get
    End Property 

    Protected Overrides Function IsCharValid( ByVal maskChar As Char, _
                                              ByVal charToValidate As Char ) As Boolean

    Dim valid As Boolean = MyBase.IsCharValid( maskChar, charToValidate ) 

    If Not valid Then
      If ( maskChar = "$"c And charToValidate = "+"c Or _
           charToValidate = "-"c Or charToValidate = "*"c Or _
           charToValidate = "/"c ) Then 

        valid = True
      End If
    End If

    Return valid

    End Function

    End Class
    End Namespace