שתף באמצעות


vbc : error BC30420: 'Sub Main' was not found in 'mainmodule.vb'. PLEASE HELP!!!

Question

Monday, December 10, 2007 4:40 AM

Okay, another question somewhat releated to my previous post, but I feel that it is worthy of a seperate thread.

 

Code Block

Module mainModule
    Sub Main(ByVal args() As String)
              MsgBox("Hello Workd")
    End Sub
End Module

 

 

When i type the following into the cmd prompt to compile

vbc.exe mainModule.vb /main:MainModule.vb

 

I get the following error

vbc : error BC30420: 'Sub Main' was not found in 'mainmodule.vb'.

 

Why is it saying that no 'Sub Main' was not found when it is there?

All replies (3)

Monday, December 10, 2007 6:25 PM ✅Answered

Try to change the startup from Project -> Properties -> Debug Section. Hope it solves your problem


Monday, December 10, 2007 7:26 PM ✅Answered

 

Code Block

Module mainModule
    Sub Main()
              MsgBox("Hello Workd")
    End Sub
End Module

 

 

this will fix your problem


Tuesday, December 11, 2007 7:13 PM ✅Answered

 

Use the following

 

vbc.exe mainModule.vb

 

This will compile or work

 

or if you want to use the /main switch then use the following.  The last .vb you previously had used is screwing things up.   It is looking for a class name not a filename - hence the .vb is the filename not the classname.

 

So the following will work

 

vbc.exe mainModule.vb /main:MainModule