Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi, every one
i have lots of textboxes in my form, i want to set code for
textbox lost focus event that change textbox back color in only one line...
please help me. :(( :((
Posted

1 solution

One approach - capture all the events in your code. Then, call a common method which uses the sender as the parameter. Change the back color of the sender.

Something like -

void textBox1_GotFocus(object sender, System.EventArgs e)
{
    CommonColorChangerMethod(sender);
}
void CommonColorChangerMethod(object sender)
{
    ((TextBox)sender).BackColor = ....
}
 
Share this answer
 
Comments
kalsa 6-Jul-16 9:56am    
Not working

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900