sfrutta gli evento GotFocus e LostFocus della textBox.
Altrimenti puoi estendere il controllo creando una classe che erediti da textBox ...
Public Class MyTextBox
Inherits TextBox
Private _ofc As Color = Color.LightBlue '//valore di default
Private _nfc As Color = Color.White '//valore di default
Public Property OnFocusColor() As Color
Get
Return _ofc
End Get
Set(ByVal value As Color)
_ofc = value
End Set
End Property
Public Property NoFocusColor() As Color
Get
Return _nfc
End Get
Set(ByVal value As Color)
_nfc = value
End Set
End Property
Protected Overrides Sub OnGotFocus(ByVal e As System.EventArgs)
BackColor = _ofc
MyBase.OnGotFocus(e)
End Sub
Protected Overrides Sub OnLostFocus(ByVal e As System.EventArgs)
BackColor = _nfc
MyBase.OnLostFocus(e)
End Sub
End Class
oppure costrire un extender da collegare ad ogni textbox che vuoi assuma tale comportamento...
Deligere oportet quem velis diligere