VB。 NET Shared Sub Main() [英] VB. NET Shared Sub Main()

查看:102
本文介绍了VB。 NET Shared Sub Main()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,


我学习C#并且已经了解VB .Net。我注意到C#你有一个

Static Void Main()(应用程序的入口点)。


那让我思考,我被告知VB.net删除了一个??黑盒子??

的软件(隐藏代码)。我的Shared sub Main()在哪里?当我创建一个

空白应用并运行它时,它会问我在哪里共享子主。那么,我可以假设

隐藏在win32应用程序上吗?如果是这样,为什么隐藏它?


谢谢



Ia??m learning C# and already know VB .Net. I noticed that C# you have a
Static Void Main () (entry point of the app).

Well that got me thinking, I was told that VB.net removed a??The Black Boxa??
of software (hidden code). Where is my Shared sub Main ()? When I create a
blank app and run it, it asked me where is Shared sub Main. So, can I assume
that ita??s hidden on a win32 app? And if so, why hide it?

Thanks

推荐答案

嗨安德烈,<
Sub Main是dotNet的标准部分。


如果用VBNet以标准方式省略它而不是您在应用程序属性中选择作为启动的表单中的
。它是
不是win32的一部分。


它不是隐藏的,你只是不必使用它,但是当你想要的时候,

随意添加很多VBNet程序员正在使用的那个类,因为我已经看到了。


Cor
Hi Andre,

Sub Main is an standard part of dotNet.

When it is ommitted as with VBNet in the standard way than that one is taken
in the Form you choose as startup in the properties of your application. It
is not a win32 part.

It is not hidden, you just do not have to use it, however when you want,
feel free to add that class a lot of VBNet programmers are using that as I
have seen.

Cor
我正在学习C#并且已经了解VB .Net。我注意到C#你有一个
Static Void Main()(应用程序的入口点)。

那让我思考,我被告知VB.net删除了The Black方框软件(隐藏代码)。我的Shared sub Main()在哪里?当我创建一个
空白应用程序并运行它时,它会问我在哪里共享子主要。那么,我可以假设它隐藏在win32应用程序上吗?如果是这样,为什么要隐藏呢?

谢谢
I''m learning C# and already know VB .Net. I noticed that C# you have a
Static Void Main () (entry point of the app).

Well that got me thinking, I was told that VB.net removed "The Black Box"
of software (hidden code). Where is my Shared sub Main ()? When I create a
blank app and run it, it asked me where is Shared sub Main. So, can I
assume
that it''s hidden on a win32 app? And if so, why hide it?

Thanks



嗨安德烈,


Sub Main是dotNet的标准部分。


如果用VBNet以标准方式省略它,那么在表单中你需要使用

在应用程序的属性中选择启动。它是
不是win32的一部分。


它不是隐藏的,你只是不必使用它,但是当你想要的时候,

随意添加很多VBNet程序员正在使用的那个类,因为我已经看到了。


Cor
Hi Andre,

Sub Main is an standard part of dotNet.

When it is ommitted as with VBNet in the standard way than that one is taken
in the Form you choose as startup in the properties of your application. It
is not a win32 part.

It is not hidden, you just do not have to use it, however when you want,
feel free to add that class a lot of VBNet programmers are using that as I
have seen.

Cor
我正在学习C#并且已经了解VB .Net。我注意到C#你有一个
Static Void Main()(应用程序的入口点)。

那让我思考,我被告知VB.net删除了The Black方框软件(隐藏代码)。我的Shared sub Main()在哪里?当我创建一个
空白应用程序并运行它时,它会问我在哪里共享子主要。那么,我可以假设它隐藏在win32应用程序上吗?如果是这样,为什么要隐藏呢?

谢谢
I''m learning C# and already know VB .Net. I noticed that C# you have a
Static Void Main () (entry point of the app).

Well that got me thinking, I was told that VB.net removed "The Black Box"
of software (hidden code). Where is my Shared sub Main ()? When I create a
blank app and run it, it asked me where is Shared sub Main. So, can I
assume
that it''s hidden on a win32 app? And if so, why hide it?

Thanks



下面的说明并不完全正确,或者至少,没有措辞

完全正确。每个.net应用程序都需要一个托管入口点。 (a

" shared sub main)


但是,在Windows窗体应用程序中,vb.net编译器将会是
如果您选择了启动表单,则会自动为您创建一个。如果你选择

一个名为Form1的表格,它创建的代码是:

< STAThread> _

Public Shared Sub Main()

Application.Run(新Form1)

结束子


请注意,此代码包含在您的应用程序集中,目前

被推入Form1中。类型。所以就好像你已经在Form1类中输入了确切的代码

并将Form1.Main设置为你的启动方法。


所以没有,它并没有真正隐藏,它只是为你而方便地创造了如果你自己不用写b
。我亲自在创建VB.net时自己编写

winforms应用程序 - 它在查看代码时消除了任何歧义(你不需要b $ b b必须检查项目属性找出应用程序的起始位置,

我可以轻松自定义启动代码。

-Philip Rieck
http://philiprieck.com/blog/

" Cor Ligthert" <无************ @ planet.nl>在消息中写道

新闻:%2 **************** @ TK2MSFTNGP10.phx.gbl ...
What cor states below isn''t exactly correct, or at least, isn''t worded
exactly correct. Every .net application requires a managed entry point. (a
"shared sub main")

However, in a windows form application the vb.net compiler will
automatically create one for you if you chose a startup form. If you choose
a form named "Form1", the code it creates is :
<STAThread> _
Public Shared Sub Main()
Application.Run(New Form1)
End Sub

Note that this code is included in your application assembly, currently
pushed into the "Form1" type. So it''s as if you had typed that exact code
above into your Form1 class and set Form1.Main as your startup method.

So no, it''s not really hidden, it''s just conveniently created for you if you
don''t write it yourself. I personally write it myself when creating VB.net
winforms apps - it removes any ambiguity when looking at the code (you don''t
have to check the project properties to figure out where the app starts),
and I can easily customize the startup code.
-Philip Rieck
http://philiprieck.com/blog/
"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
嗨安德烈,Sub Main是dotNet的一个标准部分。

如果用VBNet以标准的方式省略它,那么在表格中取得的那个在
应用程序的属性中选择启动。它不是win32的一部分。

它不是隐藏的,你只是不必使用它,但是当你想要的时候,
随意添加那个类很多VBNet程序员都是正如我所看到的那样使用它。

Hi Andre,

Sub Main is an standard part of dotNet.

When it is ommitted as with VBNet in the standard way than that one is
taken in the Form you choose as startup in the properties of your
application. It is not a win32 part.

It is not hidden, you just do not have to use it, however when you want,
feel free to add that class a lot of VBNet programmers are using that as I
have seen.

Cor
我正在学习C#并且已经了解VB .Net。我注意到C#你有一个
Static Void Main()(应用程序的入口点)。

那让我思考,我被告知VB.net删除了The Black方框软件(隐藏代码)。我的Shared sub Main()在哪里?当我创建一个
空白应用程序并运行它时,它会问我在哪里共享子主。那么,我可以假设它隐藏在win32应用程序上吗?如果是这样,为什么要隐藏呢?

谢谢
I''m learning C# and already know VB .Net. I noticed that C# you have a
Static Void Main () (entry point of the app).

Well that got me thinking, I was told that VB.net removed "The Black Box"
of software (hidden code). Where is my Shared sub Main ()? When I create
a
blank app and run it, it asked me where is Shared sub Main. So, can I
assume
that it''s hidden on a win32 app? And if so, why hide it?

Thanks




这篇关于VB。 NET Shared Sub Main()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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