kaycee kaycee - 22 days ago 9
C# Question

c# textbox event for only user input

i have a Textbox control which sometimes updated programmatically and also can be update by the user.
how can i distinct between those two event ?
i'd like to have "Dirty" flag set to "true" when the user changes the text.

Answer Source

You can use the Key Down event of the text box.

      private void textBox1_KeyDown(object sender, KeyEventArgs e)
  {
      //Insert the code you want to run when the text changes here!
  }