TextBox Properties

G

Guest

HI all
i have a question?
if i have two text bo? textbox1 and textbox2.
and iwant when i enter an input to the first textbox and click enter the
cursor go to the second text box no to press the button.

and if i have one textbox, and adding value to it. iwant when i press the
enter button to remove the value beore adding the next value.

thanx
 
G

Guest

Hi SemSem,
here is a snippet of code that will clear the textbox and change focus to
the second textbox when the enter key is pressed:

void Form1_Load(object sender, EventArgs e)
{
this.textBox1.KeyPress += new
KeyPressEventHandler(textBox1_KeyPress);
}

void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == '\r')
{
this.textBox1.Text = String.Empty;
this.textBox2.Focus();
}
}

Hope that helps
Mark Dawson
http://www.markdawson.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top