Set the Text
property of the TextBox
that you are using for the username to the string "Username"
. Then, in the TextBox
's Click
event, change it to a blank string. Like so:
Private Sub TextBox1_Click(sender As Object, e As EventArgs) Handles TextBox1.Click
TextBox1.Text = ""
End Sub
Edit:
As @LarsTech mentioned, this does not address if the user tabs into the TextBox
. If you wanted to account for that too, use the TextBox
's Enter
event instead:
Private Sub TextBox1_Enter(sender As Object, e As EventArgs) Handles TextBox1.Enter
TextBox1.Text = ""
End Sub