仅用于用户输入的 TextBox 事件 [英] TextBox event for only user input

查看:14
本文介绍了仅用于用户输入的 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 事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆