Often times when developing application and using panels, getting a control to receive startup focus can be somewhat of a pain. After much trial and error and a lot of online research into the problem, I finally found a solution that worked. In my example I will show you how I overcame this problem using the form load event.
Private Sub Form1(ByVal sender As Object, ByVal e as System.EventArgs) Handles Me.Load
With Me.Textbox1 .Focus() .Select() .SelectAll() End With
End Sub
The key to this method is to call the focus event then the select event. I added the SelectAll for my own personal preference. |