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,

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.