Dim txtler() As New Class1
Dim combolar() As New Class1
Dim nense As Control
Private Sub UserForm_Initialize()
For Each nesne In UserForm1.Controls
If TypeName(nesne) = "TextBox" Then
ReDim Preserve txtler(i)
Set txtler(i).txt = nesne
i = i + 1
ElseIf TypeName(nesne) = "ComboBox" Then
ReDim Preserve combolar(i)
Set combolar(i).combo = nesne
i = i + 1
End If
Next nesne
End Sub
Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
For Each nesne In UserForm1.Controls
If TypeName(nesne) = "TextBox" Or TypeName(nesne) = "ComboBox" Then
nesne.BackColor = vbWhite
End If
Next nesne
End Sub
Sub MENU()
UserForm1.Show
End Sub
Public WithEvents txt As MSForms.TextBox
Public WithEvents combo As MSForms.ComboBox
Private Sub txt_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
txt.BackColor = vbRed
End Sub
Private Sub combo_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
combo.BackColor = vbWhite
End Sub
Public WithEvents txt As MSForms.TextBox
Public WithEvents combo As MSForms.ComboBox
Private Sub combo_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
For Each nesne In UserForm1.Controls
If TypeName(nesne) = "TextBox" Or TypeName(nesne) = "ComboBox" Then
nesne.BackColor = vbWhite
End If
Next nesne
combo.BackColor = vbRed
End Sub
Private Sub txt_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
For Each nesne In UserForm1.Controls
If TypeName(nesne) = "TextBox" Or TypeName(nesne) = "ComboBox" Then
nesne.BackColor = vbWhite
End If
Next nesne
txt.BackColor = vbRed
End Sub