如何调用按钮点击事件 [英] how to call button click event

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

问题描述

有没有办法从其他地方调用按钮点击事件?


我有一个文本框,我想在按钮点击事件时调用

用户按下文本框中的输入。


我可以这样做吗?

谢谢

Tony

Is there a way to call a button click event from somewhere else ?

I have a text box where I would like to call a button click event when a
user presses enter in the text box.

Can I do this ?
Thanks
Tony

推荐答案

" anthonymelillo" <无************ @ earthlink.net> schrieb
"anthonymelillo" <no************@earthlink.net> schrieb
有没有办法从其他地方调用按钮点击事件?

我有一个文本框,我想调用按钮点击事件
当用户在文本框中按Enter键时。

我可以这样做吗?
Is there a way to call a button click event from somewhere else ?

I have a text box where I would like to call a button click event
when a user presses enter in the text box.

Can I do this ?




如果你想在任何地方按下按钮输入表格时按

,设置表格'的接受按钮属性=按钮

-

Armin


这似乎很有效。但是有什么方法可以调用按钮事件,如果

我想在别的地方使用它吗?


谢谢

Tony


" Armin Zingler" < AZ ******* @ freenet.de>在消息中写道

news:ej ************** @ TK2MSFTNGP10.phx.gbl ...
That seems to work great. But is there any way I can call a button event if
I want to use it elsewhere ?

Thanks
Tony

"Armin Zingler" <az*******@freenet.de> wrote in message
news:ej**************@TK2MSFTNGP10.phx.gbl...
" anthonymelillo" <无************ @ earthlink.net> schrieb
"anthonymelillo" <no************@earthlink.net> schrieb
有没有办法从其他地方调用按钮点击事件?

我有一个文本框,我想调用按钮点击事件
当用户在文本框中按Enter键时。

我可以这样做吗?
Is there a way to call a button click event from somewhere else ?

I have a text box where I would like to call a button click event
when a user presses enter in the text box.

Can I do this ?



如果你希望在输入时按下按钮的任何位置
按下,设置Form'的Acceptbutton属性= Button

-
Armin



If you want the button to be pressed anywhere in the Form when enter is
pressed, set the Form''s Acceptbutton property = Button
--
Armin





我从来没有喜欢看到直接调用Button_Click等的代码。我认为最好将代码放入一个可以通过按钮或任何需要的地方调用的程序,然后通过按钮调用代码。
>

Sub Button_Click()

DoIt

End Sub


Sub DoIt()

'' - 在这里吧

结束子


Don

华盛顿州雷德蒙德

2003年10月8日星期三19:31:23 -0400,anthonymelillo

< no ************ @ earthlink.net>写道:

I''ve never liked to see code that calls Button_Click, etc. directly. I
think it''s better practice to put the code in a procedure that can
then be called by a button or wherever it''s needed.

Sub Button_Click()
DoIt
End Sub

Sub DoIt()
''--Do it here
End Sub

Don
Redmond, WA

On Wed, 8 Oct 2003 19:31:23 -0400, "anthonymelillo"
<no************@earthlink.net> wrote:
这似乎很有效。但是,如果我想在其他地方使用它,我有什么方法可以召唤按钮事件吗?

感谢


Armin Zingler < AZ ******* @ freenet.de>在消息中写道
新闻:ej ************** @ TK2MSFTNGP10.phx.gbl ...
That seems to work great. But is there any way I can call a button event if
I want to use it elsewhere ?

Thanks
Tony

"Armin Zingler" <az*******@freenet.de> wrote in message
news:ej**************@TK2MSFTNGP10.phx.gbl...
" anthonymelillo" <无************ @ earthlink.net> schrieb
"anthonymelillo" <no************@earthlink.net> schrieb
>有没有办法从其他地方调用按钮点击事件?
>
>我有一个文本框,我想称之为按钮点击事件
>当用户在文本框中按Enter键时。
>
>我可以这样做吗?
> Is there a way to call a button click event from somewhere else ?
>
> I have a text box where I would like to call a button click event
> when a user presses enter in the text box.
>
> Can I do this ?



如果你想在按下输入时按下窗体中的任何地方按钮,设置窗体'的Acceptbutton属性= Button

-
Armin



If you want the button to be pressed anywhere in the Form when enter is
pressed, set the Form''s Acceptbutton property = Button
--
Armin






这篇关于如何调用按钮点击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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