Tuesday 17 August 2010

Form_Load and Textbox.Focus()

I was working on a project recently, where I had MDI forms with SplitContainers and I came across an annoying issue where the Split Containers split bar had the focus, and it made the form look really ugly, so upon load I wanted to set the focus to a textbox, however the normal method of Textbox.Focus() doesn’t seem to work when used inside the Form_Load event, the solution to this is rather simple

Me.ActiveControl = Me.Textbox