If you start your program with sub main (main not Main) then you will face strange behaviour. It's a known bug! ;)
Printable View
If you start your program with sub main (main not Main) then you will face strange behaviour. It's a known bug! ;)
I tried both ways without any bugs!!
VB became easier because its complier doesn't differentiate Case-state of code.No matter it's Lower or Upper Cases but C++ does.
VB Code:
Sub Main() MsgBox("From Main Sub") End Sub 'Sub main() 'MsgBox("from main sub") 'End Sub
Dunno if you are doing something else!!!
What kind of strange behavior are we talking about?
Try the following and see the result:
VB Code:
Sub main() Msgbox(Application.ProductName) End sub
and then try with Sub Main().
I've even tried MAIN , absolutely gives no difference.
?
Well I dont know what you tried, but as far as i searched this is a known bug and happens in some methods and properties of System.Windows.Forms.Application class, and running before mentioned code with sub main not Main will resulat in the error:
object refrecnce not set to an instance ....
VB Code:
'I created a class (love classes) and pasted 'your code as follow : Sub Main() MsgBox(Application.ProductName) End Sub 'and 'Sub main() ' MsgBox(Application.ProductName) 'End Sub ' in a form I did this : 'Dim mymain As New Class1() 'mymain.main() 'both gave the same results . ' but if I did this: ' Dim mymain As Class1 ' mymain.main() 'I get that stupid error so . 'the error explain itself .i.e you are trying to use the 'base class itself rather than dimming an object that holds 'its instance. 'I did all this , just to assure myself ,there is no such error.
Come on man!
I said if you start your program with a Sub main in a module not calling that from a form when it is inside a class.
that error happen when while instantiating subs or func. so I tried that.
oh YOU ARE RIGHT. when I set the app startup from module and run the app , it fires the error.
sorry for that.;)