I can't seem to figure this out-

I have a single text box that has text in it. When I put the mouse in it and click it, I need the text to clear so new text can go in.

Does anyone have a sample?


Recommended Answers

All 3 Replies


You can do it like this:

Private Sub TextBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseDown
        TextBox1.Text = ""
    End Sub

Thanks a lot- that was pretty simple.


Be a part of the DaniWeb community

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