borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Server)Next Topic (get values from a file) New Topic New Poll Post Reply
AndreaVB Forum : VB General : press Tab in Tab control?
Poster Message
luckyboy
Level: VB Lord

Registered: 05-05-2005
Posts: 160

icon press Tab in Tab control?

There are 3 controls in a form.
text1, combo1, sstab1(Microsoft Tabbed Dialog Control 6.0)

text1 property:
tabIndex=0

combo1 property:
tabIndex=1

sstab1 property:
Default property

text1 container to Tab0
combo1 contrainer to Tab1

1. when i press tab in text1 , it is automaticaly set forcus in combo1 in tab1.
2. How can i control Key Tab?


____________________________
Please help out.

____________________________
Attached:
untitled3.gif (9 KB)

19-10-2006 at 01:58 AM
View Profile Send Email to User Show All Posts | Quote Reply
admin
Level: Administrator


Registered: 04-04-2002
Posts: 530
icon Re: press Tab in Tab control?

try using this code:

Option Explicit

Private Sub Form_Load()
    SSTab1.TabStop = False
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
    If KeyAscii = Asc(vbTab) Then
        SSTab1.Tab = 1
        Combo1.SetFocus
    End If
End Sub


by disabling TabStop in ssTab you can handle it in the KeyPress event of the textbox, this because it is the only control in the tab that can receive focus

____________________________
AndreaVB

25-10-2006 at 06:43 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
luckyboy
Level: VB Lord

Registered: 05-05-2005
Posts: 160
icon Re: press Tab in Tab control?

if have many text box in tab 0. can i do this without disable the tab stop in text box?

____________________________
Please help out.

25-10-2006 at 07:29 AM
View Profile Send Email to User Show All Posts | Quote Reply
admin
Level: Administrator


Registered: 04-04-2002
Posts: 530
icon Re: press Tab in Tab control?

if you have many controls you have to disable TabStop for every control and manage it through code, you'll have to handle all KeyPress events to define your sequence until the last textbox that will move the focus to the next tab and the combo box

i.e. text1 will pass focus to text2 in his KeyPress event, text2 will move focus to text3 and then text3 will chose a new tab and move focus to combobox, you'll have to wite the KeyPress event for every control in your form

____________________________
AndreaVB

25-10-2006 at 08:28 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaVB Forum : VB General : press Tab in Tab control?
Previous Topic (Server)Next Topic (get values from a file) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder