Handle the TextBox.Enter and Leave events:
private void myTextBox_Enter(object sender, EventArgs e)
{
TextBox tb = sender as TextBox;
if (tb != null)
{
tb.BackColor = Color.Silver;
}
}
private void myTextBox_Leave(object sender, EventArgs e)
{
TextBox tb = sender as TextBox;
if (tb != null)
{
tb.BackColor = Color.White;
}
}