Collections VB6中每个循环的简单断开
我正在为包含字符串的vb6集合编写一个Contains方法 但是,我无法在我的foreach上获得正确的语法Collections VB6中每个循环的简单断开,collections,foreach,vb6,Collections,Foreach,Vb6,我正在为包含字符串的vb6集合编写一个Contains方法 但是,我无法在我的foreach上获得正确的语法 我应该更改什么?您正在VB6中使用VB.NET声明语法将对象作为对象进行暗显//对于列中的每个对象 Public Function Contains(col as Collection, key as Variant) as Boolean Dim thing as Object '// this is the key For Each thing in col
我应该更改什么?您正在VB6中使用VB.NET声明语法<代码>将对象作为对象进行暗显//对于列中的每个对象
Public Function Contains(col as Collection, key as Variant) as Boolean
Dim thing as Object '// this is the key
For Each thing in col
If CStr(key) = CStr(thing) then
Contains = True
Exit Function
End If
Next
Contains = False
End Function