仅用于用户输入的 TextBox 事件

TextBox event for only user input(仅用于用户输入的 TextBox 事件)

本文介绍了仅用于用户输入的 TextBox 事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文本框控件,它有时以编程方式更新,也可以由用户更新.我如何区分这两个事件?我想要一个Dirty"标志设置为真";当用户更改文本时.

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 a "Dirty" flag set to "True" when the user changes the text.

推荐答案

可以使用文本框的Key Down事件.

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!
  }

这篇关于仅用于用户输入的 TextBox 事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:仅用于用户输入的 TextBox 事件

基础教程推荐