Professional Documents
Culture Documents
PROCEDURES:
A block of program code that performs a
specific task
Function procedure:
Sub procedure:
Returns a value after performing
its task Does not return a value
Two types of
Sub
procedures: Independent
Event Sub procedure:
procedure:
Collection of code
Sub procedure that that can be invoked
is associated with a from one or more
specific object and places in an
event application
Automatically
processed when the Not associated with
associated event an event
occurs
Page 68
Visual Basic .Net Programming
Statements
Return expression
End Function
variable = function_name()
Page 69
Chapter 6 Applying Procedures and Functions
Return luas
End Function
radius = txtradius.Text
kira = GetCircleArea(radius)
lblarea.Text = kira.ToString("n2")
End Sub
Page 70
Visual Basic .Net Programming
Sub procedure_name()
Statements
End Sub
Call procedure_name()
OR
procedure_name()
Page 71
Chapter 6 Applying Procedures and Functions
Add listbox and button to your form. The output as shown in Figure
6.10.
lstoutput.Items.Add("Now I am calling
Write in
DisplayMessage procedure")
one line
DisplayMessage()
End Sub
Sub DisplayMessage()
lstoutput.Items.Add("")
lstoutput.Items.Add("")
End Sub
Page 72
Visual Basic .Net Programming
Page 73
Chapter 6 Applying Procedures and Functions
Add listbox and button to your form. The output as shown in Figure
6.14.
Change(num)
End Sub
nombor = 5
End Sub
Page 74
Visual Basic .Net Programming
End Sub
End Sub
Page 75
Chapter 6 Applying Procedures and Functions
Page 76