如何在代码中按下命令按钮? [英] How do I press a command button in code?

查看:64
本文介绍了如何在代码中按下命令按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在VB6中,您需要做的就是将命令按钮的名称设置为True

如:


cmdGo = True


但这在vb.net中不起作用


是否有代码示例显示如何执行此操作?

In VB6 all you needed to do was set the name of the command button to True
like:

cmdGo = True

but this does not work in vb.net

Is there a code sample that shows how to do this?

推荐答案

" Darrell Wesley" <沓*********** @ discussions.microsoft.com> schrieb:
"Darrell Wesley" <Da***********@discussions.microsoft.com> schrieb:
在VB6中,您需要做的就是将命令按钮的名称设置为True


cmdGo = True

但这在vb.net中不起作用
In VB6 all you needed to do was set the name of the command button to True
like:

cmdGo = True

but this does not work in vb.net




\\\

Me.Command1.PerformClick()

///


-

MS Herfried K. Wagner

MVP< URL:http ://dotnet.mvps.org/>

VB< URL:http://classicvb.org/petition/>



\\\
Me.Command1.PerformClick()
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>


你好Darrell,


用于调用按钮按下事件传递所有必需参数:这里是

一个例子:


Command1_click(没什么,没什么)''我们正在传递任何东西因为我们不想要

没有什么可以通过的。


如果你想传递一些你可以在这里做的参数。


我希望这是有用的


谢谢

Mona

[Grapecity]


" Darrell Wesley" <沓*********** @ discussions.microsoft.com>在留言中写道

新闻:3A ********************************** @ microsof t.com ...
Hello Darrell,

For calling a button press event pass all the required parameters: here is
an example:

Command1_click(nothing,nothing) ''We are passing nothing becasue we dont want
nothing to be passed.

If you want to pass some parameters you may do here.

I hope this is helpful

Thanks
Mona
[Grapecity]

"Darrell Wesley" <Da***********@discussions.microsoft.com> wrote in message
news:3A**********************************@microsof t.com...
在VB6中,您需要做的就是将命令按钮的名称设置为True


cmdGo = True

但这在vb.net中不起作用

是否有代码示例显示如何执行此操作?
In VB6 all you needed to do was set the name of the command button to True
like:

cmdGo = True

but this does not work in vb.net

Is there a code sample that shows how to do this?


Mona,

" Mona" <莫** @ discussions.com> schrieb:
Mona,

"Mona" <mo**@discussions.com> schrieb:
用于调用按钮按下事件传递所有必需参数:这里是一个例子:

Command1_click(什么都没有)''我们正在路过没有什么因为我们不希望
没有什么可以通过。
For calling a button press event pass all the required parameters: here is
an example:

Command1_click(nothing,nothing) ''We are passing nothing becasue we dont
want
nothing to be passed.




我建议通过正确的参数值,以防止如果事件处理程序在将来访问其

参数的值时发生不可预见的问题。为此,传递对控件的引用

在第一个参数中引发事件,在第二个

参数中传递''EventArgs.Empty'' ''点击''活动。


-

MS Herfried K. Wagner

MVP< URL:http:/ /dotnet.mvps.org/>

VB< URL:http://classicvb.org/petition/>



I recommend to pass the "correct" parameter values in order to prevent
unforseeable problems from occurring if the event handler accesses its
parameter''s values in future. To do so, pass a reference to the control
raising the event in the first paramter and ''EventArgs.Empty'' in the second
parameter in the case of the ''Click'' event.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>


这篇关于如何在代码中按下命令按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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