如何让代码无需用户点击运行? [英] How to get code to run w/o user click?

查看:96
本文介绍了如何让代码无需用户点击运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(VB新手,请不要火焰)


我有一个简单的单一形式VB应用程序,我想要,在

调用,启动,初始化并显示表格

(用户界面),然后执行更多代码(一个循环,

检查某些事情等)。


我会把这个更多代码放在哪里 - 现在,我可以做到

做任何我想要的回应标准UI事件

(比如用户点击按钮)但是我希望加载表单并且

初始化,然后关闭并执行此操作更多代码没有

的用户不得不点击。


是否有事件(表单已初始化?)我可以将其绑定到?

我看到一个Form1_Load Sub,我可以用来初始化一些

的东西,但是一旦表单加载了什么就可以用来支付
触发进一步的代码w / o明确的用户互动?


谢谢,


汤姆。

解决方案

" Tom Bower" <一个******* @ discussions.microsoft.com>写了...

(VB新手,请不要火焰)


啊糟透了,没关系:-)

我会在哪里把这个更多代码放在


什么样的更多代码你希望跑吗?可以在加载时完成很多东西

。你的意思是你希望它在后台运行,而

密切关注控件或只是它正在做的事情需要用户可以看到
直到它完成?

谢谢,
Tom。




欢迎光临,

Tom





这是所有表格活动的清单

http://msdn.microsoft.com /library/de...ventsTopic.asp


Ken

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

Tom Bower <一个******* @ discussions.microsoft.com>在留言中写道

news:d4 **************************** @ phx.gbl ... < blockquote class =post_quotes>(VB新手,请不要火焰)

我有一个简单的单一形式的VB应用程序,我想在
调用,启动,初始化和显示形式
(UI),然后再执行一些代码(一个循环来检查某些事情等)。

我在哪里放这个更多代码" - 现在,我可以做它
做任何我想要的响应标准的UI事件
(比如用户点击按钮)但是我希望表单加载并初始化,然后关闭并执行此操作更多代码没有
用户必须点击。

是否有事件(表单已初始化?)我可以将其绑定到?
我看到一个Form1_Load Sub,我可以用来初始化一些东西,但是一旦表单加载了什么可以用来触发进一步的代码而没有明确的用户交互?

谢谢,
<汤姆。



*" Tom Bower" <一个******* @ discussions.microsoft.com> scripsit:

我有一个简单的单一形式VB应用程序,我想在
调用,启动,初始化和显示表单
(UI),然后去执行一些代码(一个循环来检查某些事情等)。

我会把这个更多的代码放在哪里 - 现在,我可以做它
做任何我想要的响应标准的UI事件
(比如用户点击按钮)但是我希望表单加载并初始化,然后关闭并执行此操作更多代码没有
用户必须点击。

是否有事件(表单已初始化?)我可以将其绑定到?
我看到一个Form1_Load Sub,我可以用来初始化一些东西,但是一旦表单加载了什么可以用来触发进一步的代码而没有明确的用户交互?




您必须在新线程中开始执行(关键字:

" multithreading")。在文档中查看此主题 -

如果您有任何疑问,请随时发布。


-

Herfried K. Wagner [MVP]

< http://www.mvps.org/dotnet>


(VB newbie, no flames please)

I have a simple one-form VB application which I want, on
invocation, to start up, initialize and display the form
(the UI), and then go execute some more code (a loop that
checks for certain things etc.).

Where would I put this "more code" -- now, I can make it
do whatever I want in response to a standard UI event
(like user clicks button) but I want the form to load and
initialize, then go off and do this "more code" w/o the
user having to make any clicks.

Is there an event (form initialized?) I can tie this to?
I see a Form1_Load Sub that I can use to initialize some
things, but once the form is loaded what can be used to
trigger further code w/o explicit user interaction?

Thanks,

Tom.

解决方案

"Tom Bower" <an*******@discussions.microsoft.com> wrote...

(VB newbie, no flames please)
Ah shucks, okay :-)
Where would I put this "more code"
What sort of "more code" are you hoping to run? Lots of stuff can be done
at load time. Do you mean you want it to run in the background while
keeping an eye on the controls or just that whatever it is doing needs to be
visible to the user until it finishes?
Thanks,
Tom.



Your welcome,
Tom


Hi,

Here is a list of all the form events

http://msdn.microsoft.com/library/de...ventsTopic.asp

Ken
-------------------------
"Tom Bower" <an*******@discussions.microsoft.com> wrote in message
news:d4****************************@phx.gbl...

(VB newbie, no flames please)

I have a simple one-form VB application which I want, on
invocation, to start up, initialize and display the form
(the UI), and then go execute some more code (a loop that
checks for certain things etc.).

Where would I put this "more code" -- now, I can make it
do whatever I want in response to a standard UI event
(like user clicks button) but I want the form to load and
initialize, then go off and do this "more code" w/o the
user having to make any clicks.

Is there an event (form initialized?) I can tie this to?
I see a Form1_Load Sub that I can use to initialize some
things, but once the form is loaded what can be used to
trigger further code w/o explicit user interaction?

Thanks,

Tom.



* "Tom Bower" <an*******@discussions.microsoft.com> scripsit:

I have a simple one-form VB application which I want, on
invocation, to start up, initialize and display the form
(the UI), and then go execute some more code (a loop that
checks for certain things etc.).

Where would I put this "more code" -- now, I can make it
do whatever I want in response to a standard UI event
(like user clicks button) but I want the form to load and
initialize, then go off and do this "more code" w/o the
user having to make any clicks.

Is there an event (form initialized?) I can tie this to?
I see a Form1_Load Sub that I can use to initialize some
things, but once the form is loaded what can be used to
trigger further code w/o explicit user interaction?



You will have to start the execution in a new thread (keyword:
"multithreading"). Have a look for this topic in the documentation --
if you have any questions, feel free to post them.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>


这篇关于如何让代码无需用户点击运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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