Ok I got this to work I am just wondering if there is a way to optimize it because I want the code to be very organized so others can understand it.

There is a textbox. The first time the user clicks any where on that textbox, all of the text is selected. The second time they click, it deselects and the cursor is placed at where he clicked. Simple, right?

Yes but I used a bool to do this (i know it's stupid). allSelected is a public variable.

Code:
        
    Private Sub txtUrl_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtUrl.Click
        If txtUrl.SelectionLength = 0 And allSelected = False Then
            txtUrl.SelectAll()
            allSelected = True
        Else
            allSelected = False
        End If
    End Sub
Works fine but this looks so un-professional . And my mind is all jammed up right now after 5 hours of programming I can't think straight :S.

so anyone have an idea for optimizing my code?