My app has four group boxes with four text boxes and one button in each group box what i would like to do is use the keyboard enter button to tab instead of the tab button and when it gets to my control button instead of left clicking the mouse to activate my control button I would like to press the enter key on the keyboard to activate it has anyone got any ideas how to do this

Don't know if i understood exactly what you mean, but i guess you want to simulate the TAB button behaviour with the ENTER button, to do this you can do the following (might be buggy and inefficient because quickly tested):

First you have to add keydown events to every control in your form (i assume your Form is called Form1):

private void Form1_Load(object sender, System.EventArgs e)
		{
			AddEnterEvent((Control)sender);
		}

private void AddEnterEvent(Control c)
		{
			c.KeyDown += new KeyEventHandler(c_KeyDown);

			foreach (Control ctlChildren in c.Controls)
			{
				AddEnterEvent(ctlChildren);
			}	
		}

The keydown event code:

private void c_KeyDown(object sender, KeyEventArgs e)
		{
			if (e.KeyCode == Keys.Enter)
			{
				Control ctlNext = ActiveForm.GetNextControl((Control)sender, true);
				ctlNext.Focus();
			}
		}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.