Change background color when clicked textbox in C#
        Posted  
        
            by jweinraub
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by jweinraub
        
        
        
        Published on 2010-03-08T20:15:35Z
        Indexed on 
            2010/03/08
            20:21 UTC
        
        
        Read the original article
        Hit count: 233
        
c#
I like for the textbox to change the background when the textbox has focus (if clicked with a mouse, tabbed into, etc).
I don't like the textchange method since it won't change until one character has been added.
private void txtFoo_OnGotFocus(object sender, EventArgs e)
    {
        txtFoo.BackColor = Color.LightYellow;
        txtBar.BackColor = Color.White;
    }
This doesn't seem to work for me. What am I doing wrong?
© Stack Overflow or respective owner