从Sub Main()开始保持应用程序活着 [英] Keeping application alive starting from Sub Main()

查看:59
本文介绍了从Sub Main()开始保持应用程序活着的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在移动我在vb.NET世界中的第一步,我得到了第一次麻烦......

我可以从Sub Main()启动应用程序并加载

,例如使用''set''和''show''命令的表单。用户的

输出将是表单,程序将仍然运行



在vb .NET中,如果我以同样的方式制作,因为当

执行到达Sub Main()的End Sub语句时程序终止,因此该用户将不会输出



我认为这是因为表格在

模块中声明。有办法吗?


任何人都可以帮助我吗?

提前致谢

Hi,
i''m moving my first steps in vb.NET world and i''m getting
first troubles..

in vb6 i can start an application from Sub Main() and load
for example a form using ''set'' and ''show'' command. The
output for the user will be the form and the program will
still run.

In vb .NET, if i made it in the same way, will be no
output for the user because the program terminate when the
execution reach the End Sub statement of the Sub Main().

I think this happens because the form is declared in
Module. There''s a way to do so?

Can anyone help me?
Thanks in advance

推荐答案



您可以创建一个空白项目并在其中放置一个Sub Main(),这个
将是默认的起始点。但是,你不太可能想要这样做真的这样做,你应该尝试思考VB.NET而不是旧的

方式。例如,在VB> NET中创建一个Windows窗体应用程序,你将发现你的主窗体(Form1)是启动类。当你运行时

表格会出现。


问候 - OHM


Vell <一个******* @ discussions.microsoft.com>在消息中写道

news:17 ***************************** @ phx.gbl ...
Hi,
You could create a blank project and put a Sub Main() in it, this
would be the default startpoint. However, it is unlikely you would want to
do it this way really, you should try and think VB.NET rather than the old
way. For example, create a windows forms application in VB>NET and you will
find that your primary form ( Form1 ) is the startup class. when you run it
the form will appear.

regards - OHM

"Vell" <an*******@discussions.microsoft.com> wrote in message
news:17*****************************@phx.gbl...

我正在移动我在vb.NET世界的第一步,我得到了第一个麻烦......

vb6我可以从Sub Main()启动一个应用程序,并使用''set''和''show''命令加载
例如一个表单。用户的
输出将是表单,程序将仍然运行。

在vb .NET中,如果我以相同的方式创建,将不会
用户的输出,因为当
执行到达Sub Main()的End Sub语句时程序终止。

我认为这是因为表单在模块。有办法吗?

任何人都可以帮助我吗?
提前致谢
Hi,
i''m moving my first steps in vb.NET world and i''m getting
first troubles..

in vb6 i can start an application from Sub Main() and load
for example a form using ''set'' and ''show'' command. The
output for the user will be the form and the program will
still run.

In vb .NET, if i made it in the same way, will be no
output for the user because the program terminate when the
execution reach the End Sub statement of the Sub Main().

I think this happens because the form is declared in
Module. There''s a way to do so?

Can anyone help me?
Thanks in advance





您可以创建一个空白项目并在其中放置一个Sub Main(),这个
将是默认的起始点。但是,你不太可能想要这样做真的这样做,你应该尝试思考VB.NET而不是旧的

方式。例如,在VB> NET中创建一个Windows窗体应用程序,你将发现你的主窗体(Form1)是启动类。当你运行时

表格会出现。


问候 - OHM


Vell <一个******* @ discussions.microsoft.com>在消息中写道

news:17 ***************************** @ phx.gbl ...
Hi,
You could create a blank project and put a Sub Main() in it, this
would be the default startpoint. However, it is unlikely you would want to
do it this way really, you should try and think VB.NET rather than the old
way. For example, create a windows forms application in VB>NET and you will
find that your primary form ( Form1 ) is the startup class. when you run it
the form will appear.

regards - OHM

"Vell" <an*******@discussions.microsoft.com> wrote in message
news:17*****************************@phx.gbl...

我正在移动我在vb.NET世界的第一步,我得到了第一个麻烦......

vb6我可以从Sub Main()启动一个应用程序,并使用''set''和''show''命令加载
例如一个表单。用户的
输出将是表单,程序将仍然运行。

在vb .NET中,如果我以相同的方式创建,将不会
用户的输出,因为当
执行到达Sub Main()的End Sub语句时程序终止。

我认为这是因为表单在模块。有办法吗?

任何人都可以帮助我吗?
提前致谢
Hi,
i''m moving my first steps in vb.NET world and i''m getting
first troubles..

in vb6 i can start an application from Sub Main() and load
for example a form using ''set'' and ''show'' command. The
output for the user will be the form and the program will
still run.

In vb .NET, if i made it in the same way, will be no
output for the user because the program terminate when the
execution reach the End Sub statement of the Sub Main().

I think this happens because the form is declared in
Module. There''s a way to do so?

Can anyone help me?
Thanks in advance



Hi Vell ,


如果您从Sub Main启动表单,则需要使用

Application.Run运行它,以便启动消息循环并启动应用程序

在表格卸载前不会终止...


\\\

Public Sub Main ()

Application.Run(New MyForm)

End Sub

///


希望这会有所帮助,

Gary


Vell <一个******* @ discussions.microsoft.com>在消息中写道

news:17 ***************************** @ phx.gbl ...
Hi Vell,

If you are starting a form from Sub Main, you need to run it using
Application.Run so that a message loop is started and the application
doesn''t terminate until the form is unloaded...

\\\
Public Sub Main()
Application.Run(New MyForm)
End Sub
///

Hope this helps,
Gary

"Vell" <an*******@discussions.microsoft.com> wrote in message
news:17*****************************@phx.gbl...

我正在移动我在vb.NET世界的第一步,我得到了第一个麻烦......

vb6我可以从Sub Main()启动一个应用程序,并使用''set''和''show''命令加载
例如一个表单。用户的
输出将是表单,程序将仍然运行。

在vb .NET中,如果我以相同的方式创建,将不会
用户的输出,因为当
执行到达Sub Main()的End Sub语句时程序终止。

我认为这是因为表单在模块。有办法吗?

任何人都可以帮助我吗?
提前致谢
Hi,
i''m moving my first steps in vb.NET world and i''m getting
first troubles..

in vb6 i can start an application from Sub Main() and load
for example a form using ''set'' and ''show'' command. The
output for the user will be the form and the program will
still run.

In vb .NET, if i made it in the same way, will be no
output for the user because the program terminate when the
execution reach the End Sub statement of the Sub Main().

I think this happens because the form is declared in
Module. There''s a way to do so?

Can anyone help me?
Thanks in advance



这篇关于从Sub Main()开始保持应用程序活着的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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