1 Attachment(s)
[RESOLVED] TabControl - Focus Control - Form Load
Hi, All,
I have a Tab Control within another Tab Control and I want to be able to focus the control within the child Tab Control on form load.
I have attempted many different things and it is not working.
I do have the tab click option working when you click the tab, the focus is given to the relevant control, but it is not working for me on form load.
Any ideas?
I want to focus the cursor in the Salutation ComboBox on form load.
Screen shot attached.
Re: TabControl - Focus Control - Form Load
You can't focus anything in the Load event handler because the form isn't actually visible at that stage. No matter what you do in the Load event handler, the first selectable control in the Tab order will be focused when the form is displayed. Unless you manipulate the Tab order, you need to handle the Shown event, which is raised immediately AFTER the form is displayed.
Re: TabControl - Focus Control - Form Load
I didnt even realize there was a shown event. Learned something new. Issue resolved. Thanks for the pointer.
Re: TabControl - Focus Control - Form Load
Quote:
Originally Posted by
BrailleSchool
I didnt even realize there was a shown event.
There wasn't originally so you had to mess about with the Activated event and check whether it was the first time it had been raised. I think Shown was added in .NET 2.0.