Wrox Home  
Search P2P Archive for: Go

  Return to Index  

dotnet_windows_app_design thread: Change Enter Key to Tab in C#


Message #1 by "Chris Beck" <Becksoftware@a...> on Sun, 26 Jan 2003 19:59:36
> Hi Chris

Yeah its very simple...

In the KeyDown event of the text box u have to trap the ENTER key and
simulate the TAB key instead. 

Here is the code for that

	private void textBox1_KeyDown(object sender,
System.Windows.Forms.KeyEventArgs e)
		{
			//Check whether the key pressed is the Enter key 
			//13 is the Keycode for ENTER key

			if(e.KeyValue == 13)
				//If the key pressed is enter then simulate
the TAB key.
				SendKeys.Send("{TAB}");
			
		}



Cheers.
A.John Kingsly
e-mail: john.kingsly@d...



-----Original Message-----
From: Chris Beck [mailto:Becksoftware@a...]
Sent: Monday, January 27, 2003 1:30 AM
To: Application Design for Windows Desktops
Subject: [dotnet_windows_app_design] Change Enter Key to Tab in C#


Hi,
I am trying to change the Enter key to Tab on a 26 textBox Windows Form.
Reviewed the entries in the archives for vb, but they do not work with C#.

Tried KeyPress and ProcessCmdKey.

Has anyone changed the Enter key to Tab. It is probably a simple task,
but I am not grasping it.

Thanks in advanced for any suggestions.

Chris Beck
---
Change your mail options at http://p2p.wrox.com/manager.asp or 
to unsubscribe send a blank email to



  Return to Index