Moving focus.....

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Nov 2007
Posts: 5
Reputation: rajeshnrh74 is an unknown quantity at this point 
Solved Threads: 0
rajeshnrh74 rajeshnrh74 is offline Offline
Newbie Poster

Moving focus.....

 
0
  #1
Nov 28th, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 537
Reputation: choudhuryshouvi is an unknown quantity at this point 
Solved Threads: 49
choudhuryshouvi's Avatar
choudhuryshouvi choudhuryshouvi is offline Offline
Posting Pro

Re: Moving focus.....

 
0
  #2
Nov 29th, 2007
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
Shouvik_The_Expert_Coder
Have a problem? Don't worry just give me a call and I'll fix it for you.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 71
Reputation: venkatramasamy is an unknown quantity at this point 
Solved Threads: 12
venkatramasamy's Avatar
venkatramasamy venkatramasamy is offline Offline
Junior Poster in Training

Re: Moving focus.....

 
0
  #3
Nov 29th, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 2,641
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Solved Threads: 245
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: Moving focus.....

 
0
  #4
Dec 3rd, 2007
actually Shouvik and venkatramasamy was given the solution but if you want to try other way you can use enter keys.

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub Option1_KeyPress(KeyAscii As Integer)
  2. If KeyAscii = 13 Then
  3. Option2.SetFocus
  4. End If
  5. End Sub

may help.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC