Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What do I use to allow Enter or Tab to exit text control
Message
De
30/06/2004 23:08:45
 
 
À
30/06/2004 20:12:25
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00919447
Message ID:
00919480
Vues:
8
Tony,

If I understand your question correctly, you're asking how to make the ENTER key work like the TAB key in a textbox, so that hitting ENTER sets the focus to the next control.

Assuming this is Winforms, I do it by subclassing the textbox control, and setting up something in the OnKeyDown event. Here's a code sample...
public class ccTextBox : System.Windows.Forms.TextBox 
{
	public ccTextBox()
	{
 	   this.KeyDown	+= new KeyEventHandler(OnKeyDown);
	}

	public void OnKeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
       {
		if (e.KeyCode == Keys.Enter) 
			SendKeys.Send("{TAB}"); 
	}
}
Let me know if that helps...
Kevin
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform