On LostFocus if prefer to use Trim() instead of LenB() because if use press spacebar textbox seems empty, but don't.
Also, if there are many textbox which we use a 'default' text, then I suggest to use Tag property to store the 'default' text.
Alternately, if the 'default' text is the same for more TextBoxs then we can use a variable.
Code:Private Sub Form_Load() Text1.Tag = "CLICK HERE TO ENTER ANSWER" Text1.Text = Text1.Tag End Sub Private Sub Text1_GotFocus() If Text1.Text = Text1.Tag Then Text1.Text = vbNullString End If End Sub Private Sub Text1_LostFocus() If Trim(Text1) = vbNullString Then Text1 = Text1.Tag End Sub




Reply With Quote