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.

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.


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

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
End If
End Sub

may help.