Umarım birilerinin işine yarar.
Class modül kodlar;
Kod:
Public WithEvents opt As TextBox
Public Property Set BenimOptionButton(Txttext As TextBox)
Set opt = Txttext
opt.OnEnter = "[Event Procedure]"
opt.OnExit = "[Event Procedure]"
End Property
Private Sub opt_Enter()
Dim TxtCtl As Control
For Each TxtCtl In Forms("FormTextbox")
TxtCtl.BackColor = vbWhite
Next
opt.BackColor = vbGreen
End Sub
Private Sub opt_Exit(Cancel As Integer)
opt.BackColor = vbWhite
End Sub
Option Compare Database
Private Kontrol As New Collection
Private Sub Form_Load()
Dim i As Byte
Dim TxtOpt As ClsTextbox
Dim ctl As Control
Dim arr
arr = Array("textbox1", "textbox3", "textbox5")
For i = LBound(arr) To UBound(arr)
For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
If ctl.Name = arr(i) Then
Set TxtOpt = New ClsTextbox
Set TxtOpt.BenimOptionButton = ctl
Kontrol.Add TxtOpt
GoTo var:
End If
End If
Next
var:
ctl.BackColor = vbWhite
Next
Erase arr
End Sub