Click here to Skip to main content
15,921,837 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to write this regex? Pin
imbiz9-Jun-10 1:19
imbiz9-Jun-10 1:19 
GeneralRe: How to write this regex? Pin
OriginalGriff9-Jun-10 1:22
mveOriginalGriff9-Jun-10 1:22 
GeneralRe: How to write this regex? Pin
imbiz9-Jun-10 1:50
imbiz9-Jun-10 1:50 
GeneralRe: How to write this regex? Pin
OriginalGriff9-Jun-10 2:12
mveOriginalGriff9-Jun-10 2:12 
GeneralRe: How to write this regex? Pin
Luc Pattyn9-Jun-10 1:46
sitebuilderLuc Pattyn9-Jun-10 1:46 
GeneralRe: How to write this regex? Pin
OriginalGriff9-Jun-10 2:08
mveOriginalGriff9-Jun-10 2:08 
GeneralRe: How to write this regex? Pin
AspDotNetDev10-Jun-10 12:40
protectorAspDotNetDev10-Jun-10 12:40 
GeneralRe: How to write this regex? Pin
AspDotNetDev10-Jun-10 12:41
protectorAspDotNetDev10-Jun-10 12:41 
QuestionMaximum Width And Height of panel Pin
VCsamir8-Jun-10 21:42
VCsamir8-Jun-10 21:42 
AnswerRe: Maximum Width And Height of panel Pin
DaveyM698-Jun-10 22:27
professionalDaveyM698-Jun-10 22:27 
AnswerRe: Maximum Width And Height of panel Pin
Tsuda Kageyu8-Jun-10 22:39
Tsuda Kageyu8-Jun-10 22:39 
QuestionMerge menu items using the MenuStrip Pin
Eduard Keilholz8-Jun-10 21:29
Eduard Keilholz8-Jun-10 21:29 
QuestionAdvancing On Pressing Enter Pin
Roger Wright8-Jun-10 19:43
professionalRoger Wright8-Jun-10 19:43 
AnswerRe: Advancing On Pressing Enter Pin
Anshul R8-Jun-10 20:21
Anshul R8-Jun-10 20:21 
AnswerRe: Advancing On Pressing Enter Pin
Peace ON8-Jun-10 20:37
Peace ON8-Jun-10 20:37 
GeneralRe: Advancing On Pressing Enter Pin
Roger Wright8-Jun-10 20:47
professionalRoger Wright8-Jun-10 20:47 
AnswerRe: Advancing On Pressing Enter Pin
Dan Mos8-Jun-10 20:47
Dan Mos8-Jun-10 20:47 
GeneralRe: Advancing On Pressing Enter Pin
Roger Wright8-Jun-10 20:52
professionalRoger Wright8-Jun-10 20:52 
GeneralRe: Advancing On Pressing Enter Pin
Dan Mos8-Jun-10 20:55
Dan Mos8-Jun-10 20:55 
AnswerRe: Advancing On Pressing Enter Pin
Henry Minute9-Jun-10 0:19
Henry Minute9-Jun-10 0:19 
Hi Roger,

The answers give already, work perfectly well in circumstances where you know the Name of the control that you want to go to and are prepared to write an individual KeyDown/Keypress (select your poison) handler for each control. However, for circumstances where you want to simply follow the TabOrder you have already set and, where applicable, use one handler for several controls, the System.Windows.Forms.Control class has a built in method to do exactly what you want. Look up the System.Windows.Forms.Control.GetNextControl() method.

An example:
C#
private void Comunal_KeyDownHandler(object sender, System.Windows.Forms.KeyEventArgs e)
{
   if (e.KeyCode == Keys.Enter)
   {
       e.Handled = true;
       // true means go forwards
       this.GetNextControl((Control)sender, true).Focus();
   }
}


This way you can assign the handler to all the controls in your User Control, provided that you are not already using their KeyDown event for something else.
Henry Minute

Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
Why do programmers often confuse Halloween and Christmas?
Because 31 Oct = 25 Dec.

AnswerRe: Advancing On Pressing Enter Pin
Richard Andrew x649-Jun-10 4:39
professionalRichard Andrew x649-Jun-10 4:39 
Questionbinning at zero-filling data Pin
shekarchee8-Jun-10 19:41
shekarchee8-Jun-10 19:41 
AnswerRe: binning at zero-filling data Pin
EliottA9-Jun-10 2:19
EliottA9-Jun-10 2:19 
AnswerRe: binning at zero-filling data Pin
LookSharp9-Jun-10 3:40
LookSharp9-Jun-10 3:40 
QuestionClone Windows Forms Information Pin
Illegal Operation8-Jun-10 19:30
Illegal Operation8-Jun-10 19:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.