473,385 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

VB. NET Shared Sub Main()

HI,

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

Jul 21 '05 #1
20 3283
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
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

Jul 21 '05 #2
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
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

Jul 21 '05 #3
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...
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
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


Jul 21 '05 #4
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...
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
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


Jul 21 '05 #5
Just to add what Cor has posted, VB also has a weird quirk whereby if you
create an app, then go into the code module for the Class Form1 and change
the name to something other than Form1, you must then also go into the
project properties and tell if to use the new class name for the form as the
startup form. It assumes that it is still looking for Form1 and can no
longer find that class.

If you do not do this, you will get the error that Sub Main cannot be found.

--
Gerry O'Brien [MVP]
Visual Basic .NET(VB.NET)


"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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
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


Jul 21 '05 #6
Just to add what Cor has posted, VB also has a weird quirk whereby if you
create an app, then go into the code module for the Class Form1 and change
the name to something other than Form1, you must then also go into the
project properties and tell if to use the new class name for the form as the
startup form. It assumes that it is still looking for Form1 and can no
longer find that class.

If you do not do this, you will get the error that Sub Main cannot be found.

--
Gerry O'Brien [MVP]
Visual Basic .NET(VB.NET)


"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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
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


Jul 21 '05 #7
Thanks All, I wish VB.net was alittle more like C# where the code is there
for you. Maybe have a check box to show or hide the code for those that don't
want to see it.

André

"Gerry O'Brien [MVP]" wrote:
Just to add what Cor has posted, VB also has a weird quirk whereby if you
create an app, then go into the code module for the Class Form1 and change
the name to something other than Form1, you must then also go into the
project properties and tell if to use the new class name for the form as the
startup form. It assumes that it is still looking for Form1 and can no
longer find that class.

If you do not do this, you will get the error that Sub Main cannot be found.

--
Gerry O'Brien [MVP]
Visual Basic .NET(VB.NET)


"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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
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



Jul 21 '05 #8
Thanks All, I wish VB.net was alittle more like C# where the code is there
for you. Maybe have a check box to show or hide the code for those that don't
want to see it.

André

"Gerry O'Brien [MVP]" wrote:
Just to add what Cor has posted, VB also has a weird quirk whereby if you
create an app, then go into the code module for the Class Form1 and change
the name to something other than Form1, you must then also go into the
project properties and tell if to use the new class name for the form as the
startup form. It assumes that it is still looking for Form1 and can no
longer find that class.

If you do not do this, you will get the error that Sub Main cannot be found.

--
Gerry O'Brien [MVP]
Visual Basic .NET(VB.NET)


"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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
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



Jul 21 '05 #9
Does this show up in the code? I can't seem to find it. If I wanted to
write my own main to start the form, where would I put it? Just before the
class name?

"Philip Rieck" wrote:
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...
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
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



Jul 21 '05 #10
Does this show up in the code? I can't seem to find it. If I wanted to
write my own main to start the form, where would I put it? Just before the
class name?

"Philip Rieck" wrote:
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...
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
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



Jul 21 '05 #11
It doesn't show up in the code - it is injected at compile time, so it
*does* show up in the compiled IL.

If you wanted to do it yourself, you can
1) Create a module and add a "Sub Main" to it

2) Create a class file called something like "Startup.vb" and put this in
it:
Public Class Startup
<STAThread()> _
Public Shared Sub Main()
Application.Run(new Form1)
End Sub
End Class

3) put it in your existing Form1 class (inside the class)
....
Public Class Form1
Inherits System.Windows.Forms.Form

...
<STAThread()> _
Public Shared Sub Main()
Application.Run(new Form1)
End Sub
...
End Class

It doesn't really matter what class it's in, as it's a static (Shared)
method. All you need to do is make sure that it has access to the types and
members you want (Form1 is it in this case). I prefer putting it in a
Startup.cs in c#, or a module in vb.net, but I'm sure not everyone would
agree with me.

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

-
"Dennis" <De****@discussions.microsoft.com> wrote in message
news:2C**********************************@microsof t.com...
Does this show up in the code? I can't seem to find it. If I wanted to
write my own main to start the form, where would I put it? Just before
the
class name?

"Philip Rieck" wrote:
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...
> 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
>
>> 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
>>
>
>


Jul 21 '05 #12
It doesn't show up in the code - it is injected at compile time, so it
*does* show up in the compiled IL.

If you wanted to do it yourself, you can
1) Create a module and add a "Sub Main" to it

2) Create a class file called something like "Startup.vb" and put this in
it:
Public Class Startup
<STAThread()> _
Public Shared Sub Main()
Application.Run(new Form1)
End Sub
End Class

3) put it in your existing Form1 class (inside the class)
....
Public Class Form1
Inherits System.Windows.Forms.Form

...
<STAThread()> _
Public Shared Sub Main()
Application.Run(new Form1)
End Sub
...
End Class

It doesn't really matter what class it's in, as it's a static (Shared)
method. All you need to do is make sure that it has access to the types and
members you want (Form1 is it in this case). I prefer putting it in a
Startup.cs in c#, or a module in vb.net, but I'm sure not everyone would
agree with me.

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

-
"Dennis" <De****@discussions.microsoft.com> wrote in message
news:2C**********************************@microsof t.com...
Does this show up in the code? I can't seem to find it. If I wanted to
write my own main to start the form, where would I put it? Just before
the
class name?

"Philip Rieck" wrote:
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...
> 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
>
>> 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
>>
>
>


Jul 21 '05 #13
On Wed, 6 Oct 2004 10:50:11 -0500, Philip Rieck wrote:
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


Since you cannot see it, then by definition, it is hidden. The OP was just
making the observation that VB.Net was supposed to have eliminated that
type of "Black Box" functionality. Yet it still exists.

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
Jul 21 '05 #14
Andre
Thanks All, I wish VB.net was alittle more like C# where the code is
there
for you. Maybe have a check box to show or hide the code for those that
don't
want to see it.


In VBNet is as well all the code for you, the only thing is that there is in
this case used a feature of the .Net framework what is not done in C#.

In C# you cannot use it, in VBNet you are free to use it.

Cor

Jul 21 '05 #15
"Gerry O'Brien [MVP]" <gerry dot obrien at gmail dot com> schrieb:
Just to add what Cor has posted, VB also has a weird quirk whereby if you
create an app, then go into the code module for the Class Form1 and change
the name to something other than Form1, you must then also go into the
project properties and tell if to use the new class name for the form as
the startup form. It assumes that it is still looking for Form1 and can
no longer find that class.

If you do not do this, you will get the error that Sub Main cannot be
found.


ACK, but VS.NET will kindly show a dialog that allows picking the new
startup object :-).

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

Jul 21 '05 #16
Thanks Philip for a VERY clear explaination.

"Philip Rieck" wrote:
It doesn't show up in the code - it is injected at compile time, so it
*does* show up in the compiled IL.

If you wanted to do it yourself, you can
1) Create a module and add a "Sub Main" to it

2) Create a class file called something like "Startup.vb" and put this in
it:
Public Class Startup
<STAThread()> _
Public Shared Sub Main()
Application.Run(new Form1)
End Sub
End Class

3) put it in your existing Form1 class (inside the class)
....
Public Class Form1
Inherits System.Windows.Forms.Form

...
<STAThread()> _
Public Shared Sub Main()
Application.Run(new Form1)
End Sub
...
End Class

It doesn't really matter what class it's in, as it's a static (Shared)
method. All you need to do is make sure that it has access to the types and
members you want (Form1 is it in this case). I prefer putting it in a
Startup.cs in c#, or a module in vb.net, but I'm sure not everyone would
agree with me.

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

-
"Dennis" <De****@discussions.microsoft.com> wrote in message
news:2C**********************************@microsof t.com...
Does this show up in the code? I can't seem to find it. If I wanted to
write my own main to start the form, where would I put it? Just before
the
class name?

"Philip Rieck" wrote:
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...
> 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
>
>> 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
>>
>
>


Jul 21 '05 #17
Cor Ligthert <no************@planet.nl> wrote:
In VBNet is as well all the code for you, the only thing is that there is in
this case used a feature of the .Net framework what is not done in C#.

In C# you cannot use it, in VBNet you are free to use it.


Which framework feature are you talking about, Cor? I'm not doubting
you - just trying to work out exactly what you mean.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #18
Jon,

I have it from a book, which I have not in my possesion now.

I do not like to argue about it now, (not that I do not believe it is true,
however I am not completly sure on which level it is, build on top or build
as feature in some classes, I know that it works with WindowForms, Webforms,
Webservices and a self build Sub Main object so probably it is not a build
in feature in some classes however in a higher level).

I cannot find at the moment the same information I readed on MSDN.

However this will still cover in my opinion my last answer.

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

I hope this gives some idea's

Cor

"Jon Skeet [C# MVP]" <sk***@pobox.com>

Cor Ligthert <no************@planet.nl> wrote:
In VBNet is as well all the code for you, the only thing is that there is
in
this case used a feature of the .Net framework what is not done in C#.

In C# you cannot use it, in VBNet you are free to use it.


Which framework feature are you talking about, Cor? I'm not doubting
you - just trying to work out exactly what you mean.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Jul 21 '05 #19
Cor Ligthert <no************@planet.nl> wrote:
I have it from a book, which I have not in my possesion now.

I do not like to argue about it now, (not that I do not believe it is true,
however I am not completly sure on which level it is, build on top or build
as feature in some classes, I know that it works with WindowForms, Webforms,
Webservices and a self build Sub Main object so probably it is not a build
in feature in some classes however in a higher level).

I cannot find at the moment the same information I readed on MSDN.

However this will still cover in my opinion my last answer.

http://msdn.microsoft.com/library/de...ary/en-us/vsin
tro7/html/vxurfstartupobjectdialogbox.asp

I hope this gives some idea's


If you're talking about VB.NET projects not needing to have an explicit
Main method in code, then I believe it's just the VB.NET compiler
putting one in for you if you tell it which type to use and if that
type inherits from Form.

Here's a nice small sample:

-------- Test.vb ----------
Option Strict On

Public Class Test
Inherits System.Windows.Forms.Form
End Class
---------------------------

Compile with:
vbc /r:System.dll,System.Windows.Forms.dll /main:Test Test.vb

Then look at the result - an exe with a perfectly normal Main method in
the Test type.

In other words, this isn't a framework feature which C# can't use, it's
a VB.NET compiler feature (and not one I personally like, but that's a
different matter).

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #20

"Jon Skeet>
In other words, this isn't a framework feature which C# can't use, it's
a VB.NET compiler feature (and not one I personally like, but that's a
different matter).

I said I am now not in the possition of the book where I thought that I had
readed it in, therefore I have no start point for furter investigation and
did even not want to go for idalsm what I could have done before, however
than still does not misprove what I thought I have readed.

That you personally not like this feature in VBNet is your personally
decission as you wrote.

The Sub Main is even from before the C time as a needed hard named
startpoint (address 0). I never liked it that it was not variable.

To like this, sounds for me very conservative, while I like innovation.

Cor
Jul 21 '05 #21

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Srijit Kumar Bhadra | last post by:
Hello, Here is some sample code with pywin32 build 203 and ctypes 0.9.6. Best regards, /Srijit File: SharedMemCreate_Mutex_win32all.py # This application should be used with...
10
by: John Brock | last post by:
I have a base class with several derived classes (I'm writing in VB.NET). I want each derived class to have a unique class ID (a String), and I want the derived classes to inherit from the base...
15
by: andre | last post by:
HI, 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...
7
by: Steve | last post by:
Hi, We have an application framework library that gets statically linked to any applications we produce. (Windows apps, but I don't think that matters here). The framework is based heavily on...
1
by: izhar.wallach | last post by:
Hi, I'm trying to write an application which have a component that I like to modify without restarting it. Thus, I was thinking of using a shared object for that component. However, in the...
3
by: tropos | last post by:
(Platform: Solaris with gmake and native Sun C++ compiler) Problem: If I create a shared object (.so file) and load it into a executable, the loader correctly runs constructors of static...
2
by: shahehe | last post by:
Hi I have overloaded new in a shared library (s1.so) sucessfully. but I do not what main program and any other shared library to be able to use this new operator. In other words, I do not...
7
by: akennis | last post by:
First of all, sorry for duplicating this post. I put it up in the alt.comp.lang.learn.c-c++ mistakenly. I'm investigating a problem whereby exceptions thrown from functions in a Shared Library...
1
by: athresh | last post by:
I have created a shared library with main() .Still it is compiled and loaded during invocation. Below is the code and build file. sample_test.cpp int test_method(CfgChkSession &s) {...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.