tab key in a textbox
-
Hi, I want to give a value in a textbox when the 'tab' key is pressed in another textbox. My code is this: private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if ( (e.KeyChar.Equals(('\t'))) || (e.KeyChar.Equals(Keys.Tab)) ){ this.textBox2.Text = "hola"; } } But the only way that it works is to set the 'Multiline' and 'AcceptsTab' properties to be true (both properties at the same time, unless it not works). And the problem is that on this way, to press the tab key the focus not change to another textbox. Anybody knows a better way?
-
Hi, I want to give a value in a textbox when the 'tab' key is pressed in another textbox. My code is this: private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if ( (e.KeyChar.Equals(('\t'))) || (e.KeyChar.Equals(Keys.Tab)) ){ this.textBox2.Text = "hola"; } } But the only way that it works is to set the 'Multiline' and 'AcceptsTab' properties to be true (both properties at the same time, unless it not works). And the problem is that on this way, to press the tab key the focus not change to another textbox. Anybody knows a better way?
Why not use the Leave or Validated event for this ?
-
Why not use the Leave or Validated event for this ?