Hi, I am new to Visual Basic and am just getting to know the basics. I have already run a few programs that are based on forms.
One thing that I wanted to do was to initialise some variables in a piece of code that is run when I start the program.
My understanding is that I can create a procedure 'Main' in a Module that would be run when the program starts. My intention was to use this code to initialise my variables.
MSDN has the following:
' A "Hello World!" program in Visual Basic.
Module Hello
Sub Main()
MsgBox("Hello World!") ' Display message on computer screen.
End Sub
End Module
When I create a module using Project / Add Module and then paste this code in and try to run it I get an Invalid Outside Procedure error.
Please let me know what I am doing wrong.
One thing that I wanted to do was to initialise some variables in a piece of code that is run when I start the program.
My understanding is that I can create a procedure 'Main' in a Module that would be run when the program starts. My intention was to use this code to initialise my variables.
MSDN has the following:
' A "Hello World!" program in Visual Basic.
Module Hello
Sub Main()
MsgBox("Hello World!") ' Display message on computer screen.
End Sub
End Module
When I create a module using Project / Add Module and then paste this code in and try to run it I get an Invalid Outside Procedure error.
Please let me know what I am doing wrong.