473,396 Members | 1,936 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,396 software developers and data experts.

Tabbing Through Controls

8
I would like to Programmatically move from one control to another following the TabIndex. If the user were to fill the maximum length of any one of a number of TextBoxs they would automatically be moved to the next TextBox.

I have written this, and it works. It loops through each control until it finds the TabIndex + 1. But there must be a better way. Any ideas?

Expand|Select|Wrap|Line Numbers
  1.     Private Sub MoveToNextControl(ByVal Sender As TimeControl) Handles AttendanceControlMondayStartDay.NextControl, AttendanceControlMondayStartLunch.NextControl, etc....
  2.         'This is to go to the next Control in the TabIndex
  3.         Dim i As Integer, intCurrentTabPlus1 As Integer = Sender.TabIndex + 1
  4.         For i = 1 To Panel1.Controls().Count - 1
  5.             If Panel1.Controls(i).TabIndex = intCurrentTabPlus1 Then
  6.                 Panel1.Controls(i).Focus()
  7.                 Exit Sub
  8.             End If
  9.         Next
  10.     End Sub
Thanks!!
May 22 '07 #1
7 1724
Dököll
2,364 Expert 2GB
I would like to Programmatically move from one control to another following the TabIndex. If the user were to fill the maximum length of any one of a number of TextBoxs they would automatically be moved to the next TextBox.

I have written this, and it works. It loops through each control until it finds the TabIndex + 1. But there must be a better way. Any ideas?

Expand|Select|Wrap|Line Numbers
  1.     Private Sub MoveToNextControl(ByVal Sender As TimeControl) Handles AttendanceControlMondayStartDay.NextControl, AttendanceControlMondayStartLunch.NextControl, etc....
  2.         'This is to go to the next Control in the TabIndex
  3.         Dim i As Integer, intCurrentTabPlus1 As Integer = Sender.TabIndex + 1
  4.         For i = 1 To Panel1.Controls().Count - 1
  5.             If Panel1.Controls(i).TabIndex = intCurrentTabPlus1 Then
  6.                 Panel1.Controls(i).Focus()
  7.                 Exit Sub
  8.             End If
  9.         Next
  10.     End Sub
  11.  
  12. Thanks!!
Greetings, gtyler!

Good of you to add your code, helps a great deal, please give me a minute to search for an answer...

Dököll
May 23 '07 #2
Dököll
2,364 Expert 2GB
Greetings, gtyler!

Good of you to add your code, helps a great deal, please give me a minute to search for an answer...

Dököll
Ok, wait, do you mean to say, when a user reaches a certain number of hits within a form with textboxes to then fir up another form with additional textboxes?
May 23 '07 #3
gtyler
8
Ok, wait, do you mean to say, when a user reaches a certain number of hits within a form with textboxes to then fir up another form with additional textboxes?
Thanks so much for looking at this!

No... it is a timesheet programme. The idea is to make it as easy as possible for people to fill in their times. So once they have entered the time they got into work in one Custom Controls (in effect a TextBox), it moves straight to the next box (which would have the next number in the Tabindex) eg when you went for lunch.

By using the TabIndex I wanted to bypass writting extra code for any subsequent controls I might need to add.

I got arround the problem by looping through each of my Custom Controls (in effect TextBoxes) and checking if that Control's Tabindex was the next one in the order. If it was then it would set the Control's focus. But looping through each control seems an expensive way of just moving to the next control?
May 23 '07 #4
Dököll
2,364 Expert 2GB
I got arround the problem by looping through each of my Custom Controls (in effect TextBoxes) and checking if that Control's Tabindex was the next one in the order. If it was then it would set the Control's focus. But looping through each control seems an expensive way of just moving to the next control?
Quite welcome, I think I see what you mean, I wonder if setting focus to the next available textbox would do it:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Panel1.SetFocus
  3.  
  4.  
Whereby after user enters time, settting focus to next available seat would be automatic.

How 'bout that? Not sure if above will work cannot run anything here. Give me 'til tonight to grab my notebook...
May 24 '07 #5
gtyler
8
Quite welcome, I think I see what you mean, I wonder if setting focus to the next available textbox would do it:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Panel1.SetFocus
  3.  
  4.  
Whereby after user enters time, settting focus to next available seat would be automatic.

How 'bout that? Not sure if above will work cannot run anything here. Give me 'til tonight to grab my notebook...
------------------------------------------------------------

No... I did set the focus to the next control in my original code like this:

Panel1.Controls(i).Focus()

Where 'i' is an iterated integer that went through each of the controls. What I was hoping to find out was for a given control which control would I need to set the focus to next? Which is the next control with in the TabIndex?
May 28 '07 #6
Killer42
8,435 Expert 8TB
------------------------------------------------------------

No... I did set the focus to the next control in my original code like this:

Panel1.Controls(i).Focus()

Where 'i' is an iterated integer that went through each of the controls. What I was hoping to find out was for a given control which control would I need to set the focus to next? Which is the next control with in the TabIndex?
It's a fascinating problem. However, I wonder whether you might be able to shortcut the whole thing by using SendKeys to send a "tab" keypress. :)

Otherwise, I suspect you might be stuck with your current method, which is quite cleverly implemented.
May 29 '07 #7
gtyler
8
It's a fascinating problem. However, I wonder whether you might be able to shortcut the whole thing by using SendKeys to send a "tab" keypress. :)

Otherwise, I suspect you might be stuck with your current method, which is quite cleverly implemented.

Ahh... I see what you mean. Not really what I was looking for but it might do the trick. Thank you so much for looking into this for me!
May 29 '07 #8

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

Similar topics

3
by: Richard | last post by:
Tabbing from the first control on a form always sends me to IE's Address Bar instead of the next control, no matter how I set the TabIndex property for the controls. Why is this happening? For...
0
by: Nick | last post by:
Hi, I have a requirement to build a mouse free windows application and have to hence rely heavily on the tabbing indices. However, I'm facing some issues when the tab goes to a datagrid. It...
2
by: rmiller | last post by:
I'm in dire straits. I'm converting part of a product into VB.NET, but still need to access forms written in VB 6.0. I've got just about everyting working, but the tabbing on the form. The form...
6
by: Doug Bell | last post by:
Hi I have a DataGrid with some hidden columns and also some read Only and some ComboBox Columns. Sandard Tabbing through the Datagrid sees the focus go to the hidden columns requiring further...
3
by: Ty | last post by:
I am creating a ASP.net project and I wanted to make it so that when the user tabs on on of my pages that they do not have to tab through some controls. Is there a way to skip controls while...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.