473,386 Members | 2,042 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Programmatically move to next tab stop

balabaster
797 Expert 512MB
How do you programmatically shift focus to the next tab stop? i.e. I have a bunch of textboxes that all have their tab orders set in sequence. The user hits enter as they finish entering data in any of them, I want to programmatically move the user to the next textbox in the sequence.

Right now I'm using sendkeys to send the tab character, but there's just something about it I don't like...it seems kind of hokey. Is there a managed function call that I've missed somewhere?

Something of the style "Form1.Controls.NextControl.SetFocus" (yes, I know this isn't a valid call, it was just an example)

Any ideas? Is there any other way to do this other than SendKeys?

It seems obvious that you grab the tab index of the current control, increment it to the next number, but then you need to grab the control that has tabstop marked as true and has the next tabindex. Is there an simple way of grabbing the list of tabstopped controls, or does this have to be achieved programmatically too?
Mar 14 '08 #1
5 22187
VBWheaties
145 100+
Dont think there is a native method.
However, it was easy enough to write something.
Just send in your controls tabindex and it will set focus to the next controls tabindex.
Expand|Select|Wrap|Line Numbers
  1.     Public Sub NextControl(ByVal ctrlTabIndex As Integer)
  2.         For Each ctrl As Control In Controls
  3.             If (ctrl.TabIndex) = (ctrlTabIndex + 1) Then
  4.                 ctrl.Focus()
  5.             End If
  6.         Next
  7.     End Sub
  8.  
Mar 14 '08 #2
Plater
7,872 Expert 4TB
There is.
Take a look at:
Expand|Select|Wrap|Line Numbers
  1. this.SelectNextControl(TheCurrentControl,true,true,(either true or false),(either true or false));
  2.  
All controls have the SelectNextControl() function that takes a control as a starting point then either looks for the next or previous control by tabstop
Mar 14 '08 #3
VBWheaties
145 100+
There is.
Take a look at:
Expand|Select|Wrap|Line Numbers
  1. this.SelectNextControl(TheCurrentControl,true,true,(either true or false),(either true or false));
  2.  
All controls have the SelectNextControl() function that takes a control as a starting point then either looks for the next or previous control by tabstop
hey now, why didnt i know that? see, now I know why I come here.
Mar 14 '08 #4
balabaster
797 Expert 512MB
There is.
Take a look at:
Expand|Select|Wrap|Line Numbers
  1. this.SelectNextControl(TheCurrentControl,true,true,(either true or false),(either true or false));
  2.  
All controls have the SelectNextControl() function that takes a control as a starting point then either looks for the next or previous control by tabstop
I somehow knew that you would know the answer to that...I don't know why I don't have your direct email address :oP
Mar 14 '08 #5
Thanks Plater.
Great. It is very much useful.

@Plater
Sep 25 '13 #6

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

Similar topics

2
by: Anand Ganesh | last post by:
Hi All, How to Implement Move Next, Move Previous, Last Record and First Record in a DataGrid Control ? Is there any standard tool available in the tool box button? Thanks for your time. ...
2
by: Mat | last post by:
in my program options, users can reorder DB grid columns( in listbox) Then, i want to programmatically simulate col move event and reorder the columns. Help plz
2
by: solar | last post by:
Is there a command in VB with which to move to the next row in the table of Access database ? For example my table TblCrates consists of : CrateId City 1. Berlin I need a...
2
by: ashasprabhu | last post by:
hai, How to move records to next and previous in asp.net as we do in VB6.0
55
by: indhu | last post by:
HI all one sequence has many panels. when i select combo it displays all the fields but panel has more rows. i want to view that also. how to do that? move next and previous commds are there...
3
by: dianaj86 | last post by:
I have multiple dropdownlists each one filled with values from a specific column in the table. Also I have multiple textboxes corresponding to dropdownlists. For example, when I select an item from...
10
by: fran7 | last post by:
Hi, Anyone know the simplest solution to add a next record link. I have this <a href="page.asp?author=<%=rsCard("author")%>">link</a> I am on a page with one record and want a link to go...
0
by: nithyamca | last post by:
Hi.. I want to use enter key to move the next column in datagrid view in vb.net and when ever press the enter key in last cell in grid it create the next row . actually i am hide some cells in...
2
by: edcha | last post by:
I have the Next XML var xml = new XElement( "clients", new XElement("client", new XAttribute("id",1), new XElement( "name", "Luis"), new XElement( "country", "Portugal") ), new...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.