When you are using the tab to enter a textbox, How do you select all the text so when you begin typing it eliminates the old text?

When you are using the tab to enter a textbox, How do you select all the text so when you begin typing it eliminates the old text?

Use TextBox.SelectAll() on the Enter event.

Sample implementation, two controls using the same handler.

Private Sub TextBox_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.Enter, TextBox2.Enter
     CType(sender, TextBox).SelectAll()
End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.