文本框事件 [英] Textbox Events

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

问题描述

我有一个带有一个按钮和一个文本框的简单表单。在表单中,我创建了一个数组列表来跟踪事件,通过在每个事件中向

arraylist添加描述性字符串项来跟踪事件。我首先单击按钮然后单击

TextBox并输入a按钮。然后再次单击按钮。以下是

我得到的事件跟踪Arraylist:


但是 - GotFocus

但是 - 点击

但是 - LostFocus

txt - 改变了

但是 - GotFocus

但是 - 点击


否我在哪里可以获得事件Textbox.GotFocus或TextBox.LostFocus或

TextBox.Validating或TextBox.Validated触发。请注意,

TextBox.CauseValidation在设计时设置为True。


-

Dennis in Houston

I have a simple form with one button and one text box. In the Form, I create
an array list to track the events by adding a descriptive string item to the
arraylist in each event. I first Click on the Button then Click on the
TextBox and enter an "a" then click on the Button again. The following is
what I get for the event tracking Arraylist:

but - GotFocus
but - Clicked
but - LostFocus
txt - Changed
but - GotFocus
but - Clicked

No where do I get the events Textbox.GotFocus or TextBox.LostFocus or
TextBox.Validating or TextBox.Validated firing. Note that the
TextBox.CauseValidation is set to True at Design time.

--
Dennis in Houston

推荐答案




当您要转移的控件具有
$时,将触发验证事件b $ b它导致验证属性设置为true。我过去删除了一个

控件并对其进行了重新读取。我发现现有事件处理程序中的代码为

旧控件不起作用。我必须添加一个新的事件处理程序并从旧的事件处理程序中复制

代码。也许这会有所帮助。




---------------

" ;丹尼斯" <德**** @ discussions.microsoft.com>在留言中写道

新闻:0C ********************************** @ microsof t.com ...

我有一个带有一个按钮和一个文本框的简单表格。在表单中,我通过在每个事件中向

arraylist添加描述性字符串项来创建

数组列表以跟踪事件。我首先单击按钮然后单击

TextBox并输入a按钮。然后再次单击按钮。以下是

我得到的事件跟踪Arraylist:


但是 - GotFocus

但是 - 点击

但是 - LostFocus

txt - 改变了

但是 - GotFocus

但是 - 点击


否我在哪里可以获得事件Textbox.GotFocus或TextBox.LostFocus或

TextBox.Validating或TextBox.Validated触发。请注意,

TextBox.CauseValidation在设计时设置为True。


-

Dennis in Houston
Hi,

The validating event is fired when the control you are moving to has
it causes validation property set to true. I have in the past deleted a
control and readded it. I found the code in the existing event handlers for
the old control did not work. I had to add a new event handler and copy the
code from the old event handler. Maybe this will help.

Ken
---------------
"Dennis" <De****@discussions.microsoft.com> wrote in message
news:0C**********************************@microsof t.com...
I have a simple form with one button and one text box. In the Form, I
create
an array list to track the events by adding a descriptive string item to the
arraylist in each event. I first Click on the Button then Click on the
TextBox and enter an "a" then click on the Button again. The following is
what I get for the event tracking Arraylist:

but - GotFocus
but - Clicked
but - LostFocus
txt - Changed
but - GotFocus
but - Clicked

No where do I get the events Textbox.GotFocus or TextBox.LostFocus or
TextBox.Validating or TextBox.Validated firing. Note that the
TextBox.CauseValidation is set to True at Design time.

--
Dennis in Houston


Ken,

Txt.changed是用Dennis文本触发的。但是你的回答可能是

true。


Cor
Ken,

Txt.changed is fired is in Dennis text. However your answer could have been
true.

Cor


Dennis,


我试过这个,

我把一个文本框和一个按钮放在一个表格上

我粘贴在这个代码中

然后我运行代码,并输入Dennis。在文本框中。比它显示

Hello Dennis。

你如何捕捉这些事件,可能是有问题的。


\\\

Private Sub TextBox1_Validating(ByVal sender As Object,_

ByVal e As System.ComponentModel.CancelEventArgs)_

处理TextBox1.Validating

MessageBox.Show(" Hello"& TextBox1.Text)

End Sub

///


我希望这有帮助吗?


Cor
Dennis,

I tried this,
I put a textbox and a button on a form
I pasted in this code
Than I run the code, and typed in "Dennis" in the textbox. Than it showed
"Hello Dennis".
How do you catch those events, probably is there the problem.

\\\
Private Sub TextBox1_Validating(ByVal sender As Object, _
ByVal e As System.ComponentModel.CancelEventArgs) _
Handles TextBox1.Validating
MessageBox.Show("Hello " & TextBox1.Text)
End Sub
///

I hope this helps?

Cor


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

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