vbs过程参数--byref(默认)和byval

请看例子:

On error resume Next

Sub A1(byval s)
    s = s & "125"
End Sub

Function A2(byval s)
    s = s & "125"
    A2 = s
End Function

Dim p1, p2, p3
p1 = "what1"
p2 = "what2"
A1 p1
p3 = A2(p2)
MsgBox p1 & " : " & p2 & " : " & p3

'结论:byval: 传值,byref: 传引用

相关文章:

  • 2021-06-01
  • 2022-12-23
  • 2021-05-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-19
猜你喜欢
  • 2022-12-23
  • 2021-07-18
  • 2022-01-16
  • 2021-07-01
  • 2022-12-23
  • 2021-09-28
  • 2022-02-07
相关资源
相似解决方案