Running Rabbit
Running Rabbit

Reputation: 2720

How to get value from one TextBox to another TextBox using Tab Index

I know its a silly question but, still I wanted to know it. I have two textboxes, textbox1 and textbox2. I entered some text in textbox1. Now I want that the value of textbox one should be displayed on textbox2 when I move from textbox1 to textbox2 using tab index or by clicking my mouse on textbox2. I know I can make us of the mouse over event. But it will be great if I get some good opinion from you. Thanks in advance

Upvotes: 0

Views: 8552

Answers (1)

ravidev
ravidev

Reputation: 2738

private void textBox1_Leave(object sender, EventArgs e)
    {
        textBox2.Text = textBox1.Text;
    }

    private void textBox2_Enter(object sender, EventArgs e)
    {
        textBox2.Text = textBox1.Text;
    }

Upvotes: 1

Related Questions