I have written this code:
private void maskedNASC_KeyDown(object sender, KeyEventArgs e)
{
maskedNASC.BackColor = Color.Aqua;
}
private void maskedNASC_Leave(object sender, EventArgs e)
{
maskedNASC.BackColor = Color.White;
}
I want to apply this property to all the textboxes and masked texts of the form.
I have see many codes like this:
void SetProperty(Control ctr) // resalta textbox onfocus
{
foreach (Control control in ctr.Controls)
{
if (control is TextBox)
{
control.Leave == control.BackColor = Color.Aqua;
control.KeyDown += BackColor = Color.White ;
}
}
}
What is the right way to write this??
Thanks. Alejandro.
I have add this to the form1.designer :
this.maskedNASC.Leave += TextBoxEvent_Leave;
this.maskedNASC.KeyDown += TextBox_KeyDown;
but the code below have an error
[![enter image description here][1]][1]