Changes

Jump to: navigation, search

Visual Basic Modules and Procedures

751 bytes added, 15:16, 31 July 2007
Defining Visual Basic Subroutines
== Defining Visual Basic Subroutines ==
 
Subroutines are declared inside Visual Basic Modules. Our newly created module in Visual Studio contains the following:
 
<pre>
Module Math
 
End Module
</pre>
 
We are now going to add a subroutine called ''DisplayResult'' to this module. For syntax for a Visual Basic subroutine is as follows:
 
<tt>Public Sub DisplayResult()</tt><br>
 
The ''Public'' keyword indicates that this subroutine is accessible from Visual Basic code residing in other modules. The ''Sub'' keyword indicates that this is a Subroutine (as opposed to a Function) and as such, does not return a value on completion. Finally, the name of the Subroutine is provided. The parentheses are used to hold any parameters which may be passed through to the Subroutine when it is called.
== Defining Visual Basic Functions ==

Navigation menu