“结束编辑”事件在文本框中 [英] Event for "end edit" in a text box

查看:102
本文介绍了“结束编辑”事件在文本框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在winform(c#)中使用文本框,并使用的文本在数据库中进行查询。

I am using a textbox in winform (c#) and using the text of to make consults in a database.

但是我需要不断地查询文本框的文本每次文本更改时。因此,对于这些我使用KeyUp。但是这个事件太慢​​了。

But i need constantly consult the text of the textbox every time that text change. So for these i use the KeyUp. But this event is too slow.

是否有任何事件在文本框编辑完成后才触发?我考虑了完成2个条件

Is any event that just fire when the textbox editing has been finished ?. I consider for finish 2 conditions

控件失去了焦点。
控件有200毫秒没有按键操作

The control lost focus. The control has 200ms without keypress

推荐答案

您可以使用 LostFocus 事件,用于在用户单击文本框外的控件时捕获。

You could use the LostFocus event, to capture when the user clicks on a control outside the textbox.

否则,您需要从现有事件之一中进行选择。 (在此处列出

Otherwise, you'll need to choose from one of the existing events. (Listed here)

想起来,您可能必须捕获多个事件。如果有人复制/粘贴,则拖动DragDrop,例如...

Come to think of it, you will likely have to capture multiple events. DragDrop if someone copies/pastes, for example...

这篇关于“结束编辑”事件在文本框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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