954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Moving focus.....

In vb6 form I've 1 Textbox, 2 option buttons & 1 command button
my need is I want to move from one option button to other by pressing
Tab key. Help me out. This is customer requirement.

rajeshnrh74
Newbie Poster
5 posts since Nov 2007
Reputation Points: 10
Solved Threads: 0
 

you have to set the TAB INDEX property of the option buttons. select the desired control and press F4 to open its properties,scroll down and find the tab index property. there you put the value. this value becomes the sequence number after which the focus will be moved to the desired control.

For example, if you set tab index of option1 to 0 and option 2 to 1, whenever you open the form the option 1 will be selected as default. then you can press tab to easily move the focus from option 1 to option 2. in the same way you can also set the tab index for other controls also.

hope this will help.

regards
Shouvik

choudhuryshouvi
Posting Pro
553 posts since May 2007
Reputation Points: 30
Solved Threads: 49
 

HI Rajesh,

If your need s about alternatively set focus to the option buttons,

then the tabindex propery mightnot complete your obligation

you can acheive it by using arrow keys(any one in four arrow keys...),

place the option buttons in a frame

now use arrow key to change selection(single key-no need to use different keys to move the selection)

i hope this will help you,

with regards
venkatramasamy SN

venkatramasamy
Junior Poster in Training
71 posts since Aug 2007
Reputation Points: 12
Solved Threads: 12
 

actually Shouvik and venkatramasamy was given the solution but if you want to try other way you can use enter keys.

Private Sub Option1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    Option2.SetFocus
End If
End Sub


may help.

Jx_Man
Nearly a Senior Poster
3,329 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You