How to distinguish in a C# event if a change was made from code or by the user?

I’ve been using this process, and it seems to work well. If the event fires and the focus is not in the textbox, then I ignore the request, so when I set the text the focus is elsewhere, but when the user is typing in the textbox, it has the focus, so I acknowledge the changes.

private void textNazwa_TextCanged(object sender, EventArgs e)
{
    if ( !textNazwa.Focused) 
        return; 
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)