AnarchyX
03-13-2003, 11:29 AM
Does anyone know how to change a textbox and font color without placing it in it's own Sub?
This is what I am trying to accomplish:
When a user sets focus on a text box the backcolor changes and font color changes. Once the focus is lost the textbox reverts back to white and the font to black.
Here is what I have so far:
Private Sub Text1_GotFocus()
Text1.BackColor = vbYellow ' Changes text box to yellow
Text1.ForeColor = vbRed ' Changes font to red
End Sub
Private Sub Text1_LostFocus()
Text1.BackColor = vbWhite 'Changes text box back to white after losing focus
Text1.ForeColor = vbBlack 'Changes font back to black after losing focus
End Sub
My question is: Is there anyway easier to do this? I have many text boxes per form. :huh:
TIA
This is what I am trying to accomplish:
When a user sets focus on a text box the backcolor changes and font color changes. Once the focus is lost the textbox reverts back to white and the font to black.
Here is what I have so far:
Private Sub Text1_GotFocus()
Text1.BackColor = vbYellow ' Changes text box to yellow
Text1.ForeColor = vbRed ' Changes font to red
End Sub
Private Sub Text1_LostFocus()
Text1.BackColor = vbWhite 'Changes text box back to white after losing focus
Text1.ForeColor = vbBlack 'Changes font back to black after losing focus
End Sub
My question is: Is there anyway easier to do this? I have many text boxes per form. :huh:
TIA