CustomTextBox.vb

 'Programmed by    :   Rey Sean Adorio Cañeso
'Address          :   28 I.B. Upper Calarian, Zamboanga City, Philippines
'Cell No          :   +639154684127
'
'CustomTextBox.vb
'No. of Lines     :   82
'Date Modified    :   03-12-2011
'

Imports System
Imports System.ComponentModel
Imports System.Collections.Generic
Imports System.Diagnostics
Imports System.Text
Imports System.Windows.Forms
Imports System.Drawing

Public Class CustomTextBox
    Inherits System.Windows.Forms.TextBox

#Region "Variables/Objects"

    Private _gotFocusColor As Color = Color.AliceBlue
    Private _lostFocusColor As Color = Color.FromKnownColor(KnownColor.Window)

#End Region

#Region "Properties"

    Public Property GotFocusColor() As Color
        Get
            Return Me._gotFocusColor
        End Get
        Set(ByVal value As Color)
            Me._gotFocusColor = value
        End Set
    End Property

    Public Property LostFocusColor() As Color
        Get
            Return Me._lostFocusColor
        End Get
        Set(ByVal value As Color)
            Me._lostFocusColor = value
        End Set
    End Property

#End Region

#Region "Events"

    Private Sub CustomTextBox_GotFocus(ByVal sender As Object, ByVal e As EventArgs) Handles Me.GotFocus
        Me.BackColor = Me._gotFocusColor
    End Sub

    Private Sub CustomTextBox_LostFocus(ByVal sender As Object, ByVal e As EventArgs) Handles Me.LostFocus
        Me.BackColor = Me._lostFocusColor
    End Sub

#End Region

End Class

Project Homepage: