Changes

Jump to: navigation, search

Visual Basic Modules and Procedures

46 bytes removed, 18:31, 31 July 2007
Defining Visual Basic Functions
Visual Basic Functions differ from Subroutines in that they return a value. The syntax for declaring a Function is as follows:
''scope'' Function ''functionName(parameters)'' As ''datatype''<br><br>End Function<br>
The scope value is either ''Private'' or ''Public'' depending on whether the Function is to be accessable from Visual Basic code outside of the current module. ''Function'' is the Visual Basic keyword indcates this is a Function rather than a Subroutine. ''functionName'' is the name of the function. ''parameters'' allows the parameters accepted by this Function to be defined. Finally, ''datatype'' defines the type of value returned by the Function.
With this syntax in mind we can create a Function for application which will accept the String text values from our two text fields as parameters, convert them to Integers, perform the calculation and return the result:
<pre>
 
</pre>

Navigation menu