Page 70 - Programming VB.NET
P. 70
66 Chapter 6: Procedures And Functions
6.7 By Val and By Ref Application
Add listbox and button to your form and type a code
below.
Private Sub btnval_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs)
Handles btnview.Click
Dim num As Integer = 100
lstval.Items.Add("Inside View Button.
The value of num is " & num)
Change(num)
lstval.Items.Add("Now back in View Button.
The value of num is " & num)
End Sub
Sub Change(ByVal nombor As Integer)
lstval.Items.Add("Inside Change Procedure.
The value of num is " & nombor)
nombor = 5
lstval.Items.Add("The number is now " &
nombor)
End Sub