选择全部(Ctl-A)触发TextBox控件的TextChanged事件 [英] Select All (Ctl-A) fires TextChanged Event of TextBox control

查看:68
本文介绍了选择全部(Ctl-A)触发TextBox控件的TextChanged事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含多个文本框的表单。

I have a form with several Textboxes.

当任何TextBox拥有用户更改的数据时,表单具有启用/禁用导航按钮的逻辑。这会强制用户在导航到基础表中的另一个记录之前选择是保存还是撤消更改。

The form has logic that enables/disables navigation buttons when any of the TextBoxes have data that is changed by the user. This forces the user to select whether to Save or Undo-Changes before navigating to another record in the underlying table.

有时我需要将其中一个TextBox中的数据复制到另一个应用程序中(例如电子邮件消息。)
当我点击字段然后点击Ctl-A(即Select-All)时,它会触发TextChanged事件,该事件使表格"思考"。它是"IsDirty"用Access的说法。但是,如果我只是点击该字段然后1)。按< End>
键,2)按住< Shift>向下并按< Home> key ...也模拟与Ctl-A相同,文本被选中,但TextChanged事件是
而不是被解雇。

Sometimes I need to copy the data from one of the TextBoxes into another app (such as an email message).
When I click on the field and then Ctl-A (i.e. Select-All), it fires off the TextChanged event which makes the form "think" that it "IsDirty" in Access parlance. However, if I simply click on the field and then 1). Press the <End> key, 2) Hold the <Shift> down and press the <Home> key...which also simulates the same as Ctl-A, the text is selected, but the TextChanged event is not fired.

有谁知道为什么?

感谢你提前的时间。

Paul Goldstein

Paul Goldstein

Paul D. Goldstein Forceware Systems,Inc。

Paul D. Goldstein Forceware Systems, Inc.

推荐答案

嗨Paul,

根据你的描述,Ctrl + A触发了TextChanged事件,如果我只输入Ctrl,则不会触发此事件,所以我认为"A"是"A"。 key可以通过Textbox捕获,它可能会更改TextBox内容,并触发TextChanged事件。

Based on your description, Ctrl + A fired TextChanged event, if I just input Ctrl, this event is not fired, so I think the "A" key can be capture by Textbox and it may change TextBox content, and TextChanged event is fired.

End + Shift + Home键或Home + Shift + End键用于选择char从开始位置到结束位置,这些键无法更改TextBox内容,因此不会触发TextChanged事件。

The End + Shift + Home key or Home + Shift + End key are use to select char from start location to end location, these key can not change TextBox content, so the TextChanged event will not be fired.

最佳问候,

Cherry


这篇关于选择全部(Ctl-A)触发TextBox控件的TextChanged事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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