我指的参数不是ByVal或ByRef。而是普通的× as × 例:Button As integer
Private Sub Form_MouseUp(Button As integer,Shift As integer,X As interger, Y As integer)
if Button=2 Then
Popupmenu Form1.file
End if
End sub
没有写的情况下,默认为ByRef。
ByRef Button As integer,ByRef Shift As integer,ByRef X As interger,ByRef Y As integer
实际是这样,没有区别
那么参数就是传递用的喽…
您能给我解释一下参数的概念吗?我买的书没有专门写到
Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
a = 1
b = 1
MsgBox ("初始值:a=" & Str(a) & " b=" & Str(b))
Call xxx(a, b)
MsgBox ("调用函数之后:a=" & Str(a) & " b=" & Str(b))
End Sub
Private Sub xxx(ByVal a As Integer, ByRef b As Integer)
Dim c As Integer
a = 2
b = 2
c = a + b
MsgBox ("C=" & Str(c))
End Sub这个例子演示byval byref的区别
参数其实也就是在不同的过程或者函数中间传递的变量。
比如上面的a和b
可是做菜单时确实在后面的括号中可以加这种参数啊