Balachandran
Balachandran

Reputation: 87

Override Textbox Properties In VB.NET

It is possible to override textbox properties like selectionstart property

Upvotes: 0

Views: 2716

Answers (3)

pingoo
pingoo

Reputation: 2064

Yes you can by creating your own textbox class, such as

Class MyTextBox
    Inherits TextBox

    Public Shadows Property SelectionStart As Integer
        Get
            '   Get Code
        End Get
        Set(ByVal value As Integer)
            '   Set code 
        End Set
    End Property

End Class

Upvotes: 3

Alireza Maddah
Alireza Maddah

Reputation: 5885

SelectionStart property is not marked as virtual, so you can not override it. Other properties that are virtual or overridable can be overridden.

Upvotes: 1

etoisarobot
etoisarobot

Reputation: 7794

You can create your own custom control that inherits from the textbox control and override whatever events you need to. Here is some guidance from MSDN.

Upvotes: 1

Related Questions