Changes

Jump to: navigation, search

Visual Basic Modules and Procedures

10 bytes removed, 20:53, 31 July 2007
Defining Visual Basic Functions
The scope value is either ''Private'' or ''Public'' depending on whether the Function is to be accessible from Visual Basic code outside of the current module. ''Function'' is the Visual Basic keyword which indicates that 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, perform the calculation and return the result as an Integer:
<pre>
Public Function PercentageOf(ByVal value1 As StringInteger, ByVal value2 As StringInteger) As Integer
Dim result As Integer

Navigation menu