473,405 Members | 2,210 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,405 software developers and data experts.

How to loop though controls on the form?

How to loop though controls on the form?

I set each control's TabStop and TabIndex, but at run time, I press Tab key,
it jump though first control to last control and does not go back to the
first one unless I use Alt + Tab to go reverse direction.

How can I write C# code to allow user just to use Tab kek to loop though the
controls?

Thanks!

Nov 17 '05 #1
4 3452
foreach (Control c in this.Controls)
{
//..
}

"Ryan Liu" <rl**@eSpaceSoft.com> schrieb im Newsbeitrag
news:OI**************@TK2MSFTNGP14.phx.gbl...
How to loop though controls on the form?

I set each control's TabStop and TabIndex, but at run time, I press Tab key, it jump though first control to last control and does not go back to the
first one unless I use Alt + Tab to go reverse direction.

How can I write C# code to allow user just to use Tab kek to loop though the controls?

Thanks!


Nov 17 '05 #2
Hi Ryan,

You can use the Control.SelectNextControl function to navigate controls
programatically.

--
Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com

"Ryan Liu" <rl**@eSpaceSoft.com> escribió en el mensaje
news:OI**************@TK2MSFTNGP14.phx.gbl...
How to loop though controls on the form?

I set each control's TabStop and TabIndex, but at run time, I press Tab
key, it jump though first control to last control and does not go back to
the first one unless I use Alt + Tab to go reverse direction.

How can I write C# code to allow user just to use Tab kek to loop though
the controls?

Thanks!

Nov 17 '05 #3
Default behaviour of controls is for Tab key to loop back through to the
first control, so something is not quite right. What else have you done to
the form?

Please post form code sample.

Br,

Mark.

"Ryan Liu" <rl**@eSpaceSoft.com> wrote in message
news:OI**************@TK2MSFTNGP14.phx.gbl...
How to loop though controls on the form?

I set each control's TabStop and TabIndex, but at run time, I press Tab
key, it jump though first control to last control and does not go back to
the first one unless I use Alt + Tab to go reverse direction.

How can I write C# code to allow user just to use Tab kek to loop though
the controls?

Thanks!


Nov 17 '05 #4
Thanks for all the reply. It is really helpful.

Yes, I found the problem.

I was trying to use Tab key to loop though sub-controls in a user-control.
I set this user-control Tab stop to false so all sub-control it contains can
only be negativated once, not in a loop way.

Thanks all!
Ryan
"Mark Broadbent" <no****@nospam.com> дÈëÏûÏ¢ÐÂÎÅ:uj**************@TK2MSFTNGP14.phx.gbl ...
Default behaviour of controls is for Tab key to loop back through to the
first control, so something is not quite right. What else have you done to
the form?

Please post form code sample.

Br,

Mark.

"Ryan Liu" <rl**@eSpaceSoft.com> wrote in message
news:OI**************@TK2MSFTNGP14.phx.gbl...
How to loop though controls on the form?

I set each control's TabStop and TabIndex, but at run time, I press Tab
key, it jump though first control to last control and does not go back to
the first one unless I use Alt + Tab to go reverse direction.

How can I write C# code to allow user just to use Tab kek to loop though
the controls?

Thanks!



Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Joe | last post by:
I'm wondering how to loop through controls in VB.NET. I have the code from VB6 ok, but I can't figure out how to do it correctly in .NET. This is an example from my VB6 code that loops through...
6
by: ALthePal | last post by:
Hi, I'm not sure if we are able to or even how to loop through the web forms in a VB.NET project during design time. In MSAccess we are able to go through the database -> forms collection and...
4
by: Kevin H | last post by:
Apologies in advance if this sounds slow-witted, but I didn't find it here. Need to populate some textboxes on a form. While I could hard code it (the number of options aren't that high), it...
8
by: AFN | last post by:
I want to have a routine in a page base class that will take all the text fields on a web form, and then HtmlEncode their values. I'm having trouble figuring out if I want to loop controls or...
4
by: Ryan Ternier | last post by:
Thanks for the previous help guys! I got my list box issue working, but now i'm trying to loop through all the items in my page. I want to find each listbox, once I do i strip the ID down to...
3
by: Kezza | last post by:
Hi There.. I have dynamically created some textbox and checkbox controls by adding them to a panel. Now I would like to get the values out. I have created a for each loop that I can see the...
8
by: dominique | last post by:
Hi, Is it possible (in vb.net with WinForms) to loop throw controls inside a container (form or panel) sorting the controls on a property (.tabindex for example) ? My problem : on several...
7
by: J L | last post by:
I need to loop through a form's controls collection and delete some based on type and location. I have tried For..Each and For i = 0 to form.controls.count - 1 but when I delete any it messes up...
9
tlhintoq
by: tlhintoq | last post by:
Situation: A Windows Form with a single User Control containing 4 custom controls. This lets me drop the User Control on its own form to make it a dialog, or make it part of a larger configuration...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.