【发布时间】:2009-07-08 17:54:44
【问题描述】:
在下面的代码中,我得到一个编译时错误:
ByRef Argument type mismatch.
但如果我将 i,j 的声明更改为:
Dim i As Integer
Dim j As Integer
错误消失了。为什么?
Private Sub Command2_Click()
Dim i, j As Integer
i = 5
j = 7
Call Swap(i, j)
End Sub
Public Sub Swap(ByRef X As Integer, ByRef Y As Integer)
Dim tmp As Integer
tmp = X
X = Y
Y = tmp
End Sub
【问题讨论】:
标签: vb6 pass-by-reference