0

Hi,

I have a very simple app which is changing a panel backcolor by user input "txtCustomColor" I know how to use the text box keyDown event as you can see

private void txtCustomColo_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                panelCustom.BackColor = Color.(txtCustomColo.Text);
            }
        }

As you are fully aware this event need to press the Enter btn on the keyboard. Now my question is how I can handle the event after updating the text box and Mouse clicking out of the Textbox (Could be any where but txtCustomColor even on windows taskbar)

Best Regards,

Edited by Behseini

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by PatSharbaugh
0

You could listen to the lost focus event. txtCustomColo.LostFocus += new EventHandler(txtCustomColo_LostFocus);

And then implement the method:

void txtCustomColo_LostFocus(object sender, EventArgs e)
{
   // Add code here
}

That's it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.