Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2010 Textbox to highlight as a URL bar should?

$
0
0
Hello all! This is my first post so I am sorry if I do not include the correct information, or if it is posted in the wrong place.

Once again, hello! I am looking to get a textbox, (Such as Textbox1), to act as a URL bar. I already have it setup to I can go to websites with it, and I already have it so when a user clicks it, the URL is highlighted. But I cannot figure out how to DESELECT on another click, as a web browser would. (e.g. Google Chrome url bar on first selects all text, and on another click deselects)

This is my code so far:

Code:

Private Sub TextBox1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Click
        If TextBox1.Focused Then
            TextBox1.SelectAll()
        End If
    End Sub

How would I make it deselect the URL on another click?

Thank you for taking your time to read this post.

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>