Visual Basic 6.0 Question:
I know you can do numerous things when a control either gets focus or loses focus. What I am trying to accomplish should be rather simple, but I generally am trying to make things more complicated than it really turns out to be.
What I want to do is instead of doing the following for EVERY single Control on Multiple Forms:
Private Sub txtFirstName_GotFocus()
txtFirstname.Background = vbRed
End Sub
Private Sub txtFirstName_LostFocus()
txtFirstname.Background = vbWhite
End Sub
_______________________________________
I thought about writing a function in a module that would essentially do the same thing, except that I wouldn't have to type the above code for every form.
The module I came up with was:
Public Function CheckFocus(d as control)
If d_GotFocus then
d.BackGround = vbRed
elseif d_LostFocus then
d.BackGround = vbWhite
End If
End Function
I don't think the above function will even work. Does anyone have any ideas or suggestions to accomplish this task?
I know you can do numerous things when a control either gets focus or loses focus. What I am trying to accomplish should be rather simple, but I generally am trying to make things more complicated than it really turns out to be.
What I want to do is instead of doing the following for EVERY single Control on Multiple Forms:
Private Sub txtFirstName_GotFocus()
txtFirstname.Background = vbRed
End Sub
Private Sub txtFirstName_LostFocus()
txtFirstname.Background = vbWhite
End Sub
_______________________________________
I thought about writing a function in a module that would essentially do the same thing, except that I wouldn't have to type the above code for every form.
The module I came up with was:
Public Function CheckFocus(d as control)
If d_GotFocus then
d.BackGround = vbRed
elseif d_LostFocus then
d.BackGround = vbWhite
End If
End Function
I don't think the above function will even work. Does anyone have any ideas or suggestions to accomplish this task?