Keypress在文本框中。 [英] Keypress in a textbox.

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

问题描述

我正在使用Visual Studio 2003开发一个Windows应用程序,其中我允许用户只按Enter键,而焦点在文本框上,在

为了执行搜索。我的问题是有时Keypress事件

不再被提出。我发现我可以通过

执行搜索,打开另一个表单然后尝试执行另一个

搜索来重现此行为。第二次搜索永远不会工作。


如何解决这个问题?


谢谢,

Todd Sparks

I am using Visual Studio 2003 to develop a windows application in which I
allow the users to just press Enter, while the focus is on a textbox, in
order to perform a search. My problem is that sometimes Keypress event
stops being raised. I have found that I can reproduce this behavior by
performing a search, opening up another form, then trying to perform another
search. The second search will NEVER work.

How can I fix this problem?

Thanks,
Todd Sparks

推荐答案

我想我们需要一些简化的代码来证明问题,

可以帮助你。


克里斯


Todd Sparks <共******* @ nospam.nospam>在消息中写道

新闻:%2 **************** @ TK2MSFTNGP09.phx.gbl ...
I think we will need some simplified code that demonstrates the problem to
help you out.

Chris

"Todd Sparks" <co*******@nospam.nospam> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
我是使用Visual Studio 2003开发一个Windows应用程序,我允许用户只需按Enter键,同时焦点在文本框上,以便执行搜索。我的问题是,有时候Keypress事件会停止被提升。我发现我可以通过执行搜索,打开另一个表单,然后尝试执行另一个搜索来重现此行为。第二次搜索永远不会有效。

如何解决这个问题呢?

谢谢,Todd Sparks
I am using Visual Studio 2003 to develop a windows application in which I
allow the users to just press Enter, while the focus is on a textbox, in
order to perform a search. My problem is that sometimes Keypress event
stops being raised. I have found that I can reproduce this behavior by
performing a search, opening up another form, then trying to perform
another search. The second search will NEVER work.

How can I fix this problem?

Thanks,
Todd Sparks



这是我正在使用的代码。


Private Sub customerNumberSearch(ByVal sender As Object,ByVal e As

System。 Windows.Forms.KeyPressEventArgs)处理txtCustomerNumber.KeyPress

如果e.KeyChar = Chr(13)那么

''搜索

结束If

End Sub

"克里斯,万事万物 < chris@No_Spam_Please.com>在消息新闻中写了

:%2 **************** @ TK2MSFTNGP11.phx.gbl ...
Here is the code that I am using.

Private Sub customerNumberSearch(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtCustomerNumber.KeyPress
If e.KeyChar = Chr(13) Then
''do search
End If
End Sub
"Chris, Master of All Things Insignificant" <chris@No_Spam_Please.com> wrote
in message news:%2****************@TK2MSFTNGP11.phx.gbl...
我认为我们需要一些简化的代码来证明问题,以帮助你。

Chris

Todd Sparks <共******* @ nospam.nospam>在消息中写道
新闻:%2 **************** @ TK2MSFTNGP09.phx.gbl ...
I think we will need some simplified code that demonstrates the problem to
help you out.

Chris

"Todd Sparks" <co*******@nospam.nospam> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
我正在使用Visual Studio 2003开发一个Windows应用程序,我允许用户只需按Enter键,同时焦点在文本框上,以便执行搜索。我的问题是,有时候Keypress事件会停止被提升。我发现我可以通过执行搜索,打开另一个表单,然后尝试执行另一个搜索来重现此行为。第二次搜索永远不会有效。

如何解决这个问题呢?

谢谢,Todd Sparks
I am using Visual Studio 2003 to develop a windows application in which I
allow the users to just press Enter, while the focus is on a textbox, in
order to perform a search. My problem is that sometimes Keypress event
stops being raised. I have found that I can reproduce this behavior by
performing a search, opening up another form, then trying to perform
another search. The second search will NEVER work.

How can I fix this problem?

Thanks,
Todd Sparks




这没有给我足够的信息来重现错误。


Chris


Todd Sparks <共******* @ nospam.nospam>在消息中写道

news:ev ************** @ TK2MSFTNGP14.phx.gbl ...
That does not give me enough information to reproduce the error.

Chris

"Todd Sparks" <co*******@nospam.nospam> wrote in message
news:ev**************@TK2MSFTNGP14.phx.gbl...
这是代码我正在使用。

Private Sub customerNumberSearch(ByVal sender As Object,ByVal e As
System.Windows.Forms.KeyPressEventArgs)处理txtCustomerNumber.KeyPress
如果e.KeyChar = Chr (13)然后
''搜索
结束如果
结束Sub

" Chris,万事万物 < chris@No_Spam_Please.com>
在消息新闻中写道:%2 **************** @ TK2MSFTNGP11.phx.gbl ...
Here is the code that I am using.

Private Sub customerNumberSearch(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtCustomerNumber.KeyPress
If e.KeyChar = Chr(13) Then
''do search
End If
End Sub
"Chris, Master of All Things Insignificant" <chris@No_Spam_Please.com>
wrote in message news:%2****************@TK2MSFTNGP11.phx.gbl...
我想我们需要一些简化的代码来证明问题,以帮助你。

克里斯

托德斯帕克斯 <共******* @ nospam.nospam>在消息中写道
新闻:%2 **************** @ TK2MSFTNGP09.phx.gbl ...
I think we will need some simplified code that demonstrates the problem to
help you out.

Chris

"Todd Sparks" <co*******@nospam.nospam> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
我正在使用Visual Studio 2003开发一个Windows应用程序,我允许用户只需按Enter键,同时焦点在文本框上,以便执行搜索。我的问题是,有时候Keypress事件会停止被提升。我发现我可以通过执行搜索,打开另一个表单,然后尝试执行另一个搜索来重现此行为。第二次搜索永远不会有效。

如何解决这个问题呢?

谢谢,Todd Sparks
I am using Visual Studio 2003 to develop a windows application in which I
allow the users to just press Enter, while the focus is on a textbox, in
order to perform a search. My problem is that sometimes Keypress event
stops being raised. I have found that I can reproduce this behavior by
performing a search, opening up another form, then trying to perform
another search. The second search will NEVER work.

How can I fix this problem?

Thanks,
Todd Sparks





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

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