ongke0711 > 02-08-15, 10:37 AM
Public Function SetFocusHandlers(ByRef frm As Form)
Dim ctl As Control
For Each ctl In frm
If ctl.Tag = "HighlightOnFocus" Then
ctl.OnGotFocus = "=Highlight([" & ctl.Name & "], True)"
ctl.OnLostFocus = "=Highlight([" & ctl.Name & "], False)"
End If
Next
End Function
Public Function Highlight(ByRef ctl As Control, ByVal blnFocus As Boolean)
If blnFocus = True Then
'#Doi mau border. Dung ctl.BackColor de doi mau background cua textbox
ctl.BorderColor = RGB(228, 108, 10)
ctl.BorderWidth = 1
Else
ctl.BorderColor = RGB(166, 166, 166)
ctl.BorderWidth = 1
End If
End Function
Private Sub Form_Load()
SetFocusHandlers Me
End Sub