在VB中实现向函数传递不定个数参数

niboac

关注

阅读 57

2023-01-14


在VB中实现向函数传递不定个数参数其实很容易,下面我写出代码,今天在开发的工程中正好用得上.十分实用.^_^

新建一个EXE工程,加入一个Listbox1和Command1,代码如下:

Option Explicit
Public Sub TransferPA(LST As ListBox, ParamArray Items())
Dim i
With LST
.Clear
For Each i In Items
.AddItem i
Next
End With
End SubPrivate Sub Command1_Click()
TransferPA List1, "ListItem1", "ListItem2", "ListItem3"
End Sub

点击按钮瞧瞧,不错吧.

                                                              ---by 唐细刚

精彩评论(0)

0 0 举报