You can use Enter event for this. And also if you want to change the color of first text box to the default color when you go to the next text box, that can be done with leave event.
Use this code.
private void textBox_Enter(object sender, EventArgs e)
{
TextBox a = (TextBox)sender;
a.BackColor = Color.Blue;
}
private void textBox_Leave(object sender, EventArgs e)
{
TextBox a = (TextBox)sender;
a.BackColor = SystemColors.Window;
}
Bind those events to the two text boxes. (You can even do this from the designer without writing code.)
public Form1()
{
InitializeComponent();
this.textBox1.Leave += new System.EventHandler(this.textBox_Leave);
this.textBox1.Enter += new System.EventHandler(this.textBox_Enter);
this.textBox2.Leave += new System.EventHandler(this.textBox_Leave);
this.textBox2.Enter += new System.EventHandler(this.textBox_Enter);
}
hope it will have your work done.:)