By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
463,114 Members | 758 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 463,114 IT Pros & Developers. It's quick & easy.

Tabbed Control in form

P: 67
Hi All

My next issue is that i have a form that has a tabbed control on it with 6 pages. I would like to code the tabbed control so that when the user has entered data into the last field on page1, then presses the tab button on the keyboard it moves to the first field on page2 and so on. Can this be done and if so could you show me the code to do this.

kindest regards

Jan 15 '09 #1
Share this Question
Share on Google+
5 Replies

Expert 100+
P: 375
Add an invisible control to each tab that is at the end of the Tab sequence for that page. In the OnEnter or GotFocus event of that control move the focus to the control you want on the tab page you want.
Jan 15 '09 #2

Expert 100+
P: 489
Maybe something like this for the KeyDown event on your last control.

TextControlName = Name of the last control on the page
TabControlName = Name of your Tab control
PageName = Name of the Tab page you want to go to
NextTextControl = Name of the first text control on the new tab

Expand|Select|Wrap|Line Numbers
  1. Private Sub TextControlName_KeyDown(keycode As Integer, shift As Integer)
  2. If keycode = vbKeyTab Then
  3.    Me.TabControlName.Pages.Item("PageName").SetFocus
  4.    Me.NextTextControl.SetFocus
  5.    Exit Sub
  6. End If
  7. End Sub
Jan 15 '09 #3

Expert 100+
P: 375
I'm pretty sure that setting the focus to a control on the 3rd page of the tab control will also switch the tab control to Page 3. I misspoke in my first post. The control can *not* be invisible. Just make it transparent and 1 pixel by one pixel.
Jan 15 '09 #4

Expert 5K+
P: 8,748
This Link may help you also:
Jan 15 '09 #5

P: 67
Thank you all for your replies. I have tried all the different codes and they all seem to work one way or another.

Thanks again

Jan 15 '09 #6

Post your reply

Sign in to post your reply or Sign up for a free account.