Function Procedures (VisualBasic) return a value to the calling code. They can perform
other actions before returning.
Event handlers procedures which responds to events generated by controls or objects.
Below is an example:
Private Sub Button1_Click(ByVal sender As System.Object,By Val e As _
System.EventArgs) Handles Button1.Click, Button2.Click
'insert event code here
End Sub
sender receives a reference to the object that raised the event
e passes an object specific to the event that is being handled. Provides a method for
passing an entire object of additional information
ByVal accepts a copy of the data from the local variables. No changes are made to the
contents of the local variables when the calling procedure resumes the control of execution.
(Default)
, ByRef accepts a reference of the data in the memory. In other words, the location of the
data in the memory is received by the procedure. The called procedure is hereby granted
read/write access to the local variable of the calling procedure.
Sub[routine] Procedures General-purpose procedures
Can receive arguments and pass back modified values using the arguments list.
Unlike functions, ________ don't return values associated with the _______ name.
Syntax:
_________Name([Parameters])
[Procedure Statements]
End Sub
ProcedureName name of the sub procedure you are creating
Arguments(Parameters) a list of optional variables that receives data from the local
variables of the calling procedure. Each _____ should be declared as a specific type.
ProcedureStatements a block of statements that accomplishes the work of the procedure.
sub procedure To call a ___________, use a statement similar to the following:
BirthdayGreeting("Robert")
or
Call BirthdayGreeting("Robert")