Private Sub TextBox1_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.MouseLeave
if TextBox1.Text = "" then
TextBox1.Text = "Anything"
end if
End Sub
This will leave Anything in the box if it is empty.
Thanx for the help, but the code really doesn't do much if the mouse is moved before the textbox is made blank or if the user TABs between the controls instead of using the mouse.
You beat me to the reply, I was just going to update this replay to mention that. Sorry
Visual Basic:
Private Sub TextBox1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.Leave
If TextBox1.Text = "" Then
TextBox1.Text = "Anyhing"
End If
End Sub
This will update the textbox if another is in focus.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.