简单的问题 - 什么是“发送密钥”的等价物。 ? [英] Simple question - What is the equivalent of a "Send Key" ?

查看:64
本文介绍了简单的问题 - 什么是“发送密钥”的等价物。 ?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,你怎么能以编程方式点击在表格中的按钮上?

解决方案

你好Rob,


如果你有一些代码如


Private Sub btnOK_Click(.....)

MsgBox(你好)

End Sub

你想在其他任何地方运行它只需按照名称调用这个程序就像

任何其他程序:


btnOK_Click


如果您有时不想填写这些

保留事件程序的所有参数,请将代码更改为:


Private Sub btnOK_Click(.....)

MyOK

End Sub


Private Sub MyOK()

MsgBox(你好)

结束子


并调用MyOK而不是btnOK_Click。


再见,Lorenz


9月29日,1:00 * pm,Rob < ro ... @ yahoo.comwrote:


例如,你怎么能以编程方式点击?在表格中的按钮?



假设你有一个处理Button1的事件子。点击:


Private Sub Button1_Click(ByVal sender As System。对象,_

ByVal e As System.EventArgs)处理Button1.Click


''按下按钮时代码阻止

结束子


....如果你想在Button1_Click中执行相同的代码块

,就像点击了Button1一样,这样做,你可以简单地尝试从任何地方拨打



Button1_Click(发件人,e)

希望这会有所帮助,


OnurGüzel


你好Rob,


" Rob" < ro *** @ yahoo.com写了留言

news:68 *************************** ***@comcast.com。 ..


例如,你怎么能以编程方式点击?在表格中的按钮?



Button有一个PerformClick方法。

或者使用My.Computer.Keyboard.SendKeys


For example, how could you programatically "click" on a button in a Form ?

解决方案

Hi Rob,

if you have some code like

Private Sub btnOK_Click(.....)
MsgBox("Hi there")
End Sub
und you want to run it anywhere else simply call this procedure like
any other procedure by its name:

btnOK_Click

If you sometimes don''t want to fill in all the arguments of these
reserved event procedures change the code into:

Private Sub btnOK_Click(.....)
MyOK
End Sub

Private Sub MyOK()
MsgBox("Hi there")
End Sub

and call MyOK instead of btnOK_Click.

bye, Lorenz


On Sep 29, 1:00*pm, "Rob" <ro...@yahoo.comwrote:

For example, how could you programatically "click" on a button in a Form ?

Assuming you have a event sub that handles Button1.Click like:

Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click

'' Code block here when button is pressed

End Sub

....and if you want to execute the same code block inside Button1_Click
as if Button1 is clicked, to do so, you can simply try to call sub
from anywhere:

Button1_Click(sender, e)
Hope this helps,

Onur Güzel


Hi Rob,

"Rob" <ro***@yahoo.comwrote in message
news:68******************************@comcast.com. ..

For example, how could you programatically "click" on a button in a Form ?

Button has a PerformClick method.
Alternatively use My.Computer.Keyboard.SendKeys


这篇关于简单的问题 - 什么是“发送密钥”的等价物。 ?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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