Link to home
Start Free TrialLog in
Avatar of bhlang
bhlangFlag for Canada

asked on

Manipulate TabControl from code

I have a TabControl on a form with three tabs.
Each TabPage has a set of controls on it.

Here's what I want to know how to do with code:
1. When the form is loaded, set the Focus to the first TextBox where ReadOnly = False (some TextBoxes have ReadOnly = True)
2. When the user gets to the last TextBox on a TabPage and tabs out of that TextBox, Switch to the Next TabPage.

From the answers to these, I should be able to extrapolate how to do the reverse (ie. switch to the Previous TabPage and set Focus to the Last TextBox on a TabPage).

ASKER CERTIFIED SOLUTION
Avatar of iboutchkine
iboutchkine

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bhlang

ASKER

Back in Visual Basic 6, if I were to set a TextBox with the focus in the Form Load event, then it would crash every time - the text box wasn't displayed for it to have the focus.

So when I saw your first suggestion, I though that it would fail. But I tried it anyway, and whaddya know - it worked! Now the form loads with the field I want the focus in having the focus.

And as for the second part, that's exactly what I was looking for.


Thank you very much.