我有以下函数来解析vb6中的命令行参数
Private Function GetProcessParams() As Variant
Dim i As Integer
Dim result() As Variant
Select Case Command
Case "-all"
Set GetProcessParams = allProcess.Items
Exit Function
Case "-new"
For i = 0 To allProcess.Count
Dim tmp As TableInfo
Set tmp = allProcess(i)
If tmp.isNew Then
ReDim result(i + 1)
Set result(i) = tmp
End If
Next i
Set GetProcessParams = result
Exit Function
Case Else
Dim subset() As String
subset = Split(Command, ",")
ReDim result(UBound(subset))
Dim val As String
For i = 0 To UBound(subset)
If IsNumeric(subset(i)) Then
Set result(i) = allProcess(CInt(subset(i)))
End If
Next i
Set GetProcessParams = result
Exit Function
End Select
End Function
在运行时,它在第34行停止;设置GetProcessParams =结果"在案例" -new"带消息"编译错误:需要对象"
出了什么问题?
答案 0 :(得分:1)
Set
statement仅用于分配对象引用。您的<div id="container">
<iframe src="" width="300" height="400"></iframe>
</div>
变量是变量数组,而数组在VB中不是对象引用。如果您想将数组复制到自己的变量you only need a regular assignment,而不是result
关键字。