Beginner question... Cannot name the subject

T

Tim Zottberg

Hi newsgroup,

I am trying to migrate from VB6 to VB.Net.
I am having serious understanding problems about why VB.Net 2005 Express
doesn't do what I want.
I have a C# code, and I was trying to convert it to VB.

The first thing that made (and still makes) me crazy is that seemingly I
cannot tell VB to use "sub main" as the start procedure. If anybody
knows how then that would make me really happy.

The next issue it that this code doesn't work in a module:

Imports System
Imports System.Collections.Generic
Imports System.Text
Imports IrrlichtNETCP
Imports IrrlichtNETCP.Inheritable

Module Module1
Namespace Tutorial01
Class Tutorial01
Private Shared Sub Main(ByVal args As String())
'//Foo
End Sub
End Class
End Namespace

End Module

---------------------------------
Imports are okay, but then it tells me that "Namespace-Commands can only
be stated in Namespace or Filespace" (not perfect translation of error
message, but I hope it does...).

Thanks a million for your help.
Tim
 
G

Guest

to load from the Sub Main, try making it Public, not private then go to the
project properties and change it there. that should work.
 
O

Omar Abid

Hi newsgroup,

I am trying to migrate from VB6 to VB.Net.
I am having serious understanding problems about why VB.Net 2005 Express
doesn't do what I want.
I have a C# code, and I was trying to convert it to VB.

The first thing that made (and still makes) me crazy is that seemingly I
cannot tell VB to use "sub main" as the start procedure. If anybody
knows how then that would make me really happy.

The next issue it that this code doesn't work in a module:

Imports System
Imports System.Collections.Generic
Imports System.Text
Imports IrrlichtNETCP
Imports IrrlichtNETCP.Inheritable

Module Module1
Namespace Tutorial01
Class Tutorial01
Private Shared Sub Main(ByVal args As String())
'//Foo
End Sub
End Class
End Namespace

End Module

---------------------------------
Imports are okay, but then it tells me that "Namespace-Commands can only
be stated in Namespace or Filespace" (not perfect translation of error
message, but I hope it does...).

Thanks a million for your help.
Tim

Hi,
you can download book for beginners from this site :
http://expressdotnet.freehostia.com
or directly http://expressdotnet.freehostia.com/book.html
Tutorial on the site : http://expressdotnet.freehostia.com/compiler.html
Have fun !
Omar Abid
 
T

Tom

To change to sub main, you need to go into project properties and
uncheck the "Windows Framework" box. It will then change to startup
object and you can choose it in the startup dropdown.


Try this instead:


Imports System
Imports System.Collections.Generic
Imports System.Text
Imports IrrlichtNETCP
Imports IrrlichtNETCP.Inheritable

Namespace Tutorial01
Class Tutorial01
Private Shared Sub Main(ByVal args As String())
'//Foo
End Sub
End Class
End Namespace

Modules can contain shared vars, etc. Just declaring them as Public var
as String will leave them globally accessible.




Imports System
Imports System.Collections.Generic
Imports System.Text
Imports IrrlichtNETCP
Imports IrrlichtNETCP.Inheritable

Module Module1
Namespace Tutorial01
Class Tutorial01
Private Shared Sub Main(ByVal args As String())
'//Foo
End Sub
End Class
End Namespace

End Module
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top