VERSION 5.00
Begin VB.Form Form1
Caption = "例[8-5]传值调用"
ClientHeight = 1275
ClientLeft = 60
ClientTop = 345
ClientWidth = 3840
LinkTopic = "Form1"
ScaleHeight = 1275
ScaleWidth = 3840
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "传值调用"
Height = 495
Left = 2640
TabIndex = 0
Top = 360
Width = 1095
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim x As Integer, y As Integer
x = 10
y = 20
Print "x = "; x, "y = "; y '调用前实参
Call temp(x, y)
Print "x = "; x, "y = "; y '调用后实参
End Sub
Sub temp(ByVal x As Integer, ByVal y As Integer)
x = x + 100
y = x * 60
Print "x="; x, "y="; y
End Sub