Receive keyboard events by two components simultaneously
Hi.
I want when I press a key on keyboard,
two components can get this event simultaneously.
How can I do that?
For example I have two textbox. One of them is
read only and the focus is on this textbox. I want
that when I write something, second textbox can
receive my text.
thanks friends
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Niradhip ChakrabortyRank #429 · 5.8K reputationPosted Jul 10, 2009, 5:23 AM EDT
omid9 reputationPosted Jul 10, 2009, 5:56 AM EDT
Niradhip ChakrabortyRank #429 · 5.8K reputationPosted Jul 13, 2009, 12:42 PM EDT
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (textBox1.Text != "")
{
textBox2.Text = textBox1.Text;
}
else
{
textBox2.Text = "";
}
}
private void textBox1_Leave(object sender, EventArgs e)
{
if (textBox1.Text != "")
{
textBox2.Text = textBox1.Text;
}
else
{
textBox2.Text = "";
}
}