VB 6如何使自定义集合类支持每个

时间:2011-04-12 01:44:30

标签: vb6 enumerate

我被安置在一个项目中,其客户端前端是用VB 6编写的,确认!我正在尝试开发一个支持For ... Each语法的自定义集合类。在VB 6中这可能吗?或者我坚持使用For..Next with counter来识别索引。

感谢您的帮助!

1 个答案:

答案 0 :(得分:19)

关键部分是将其添加到自定义集合类...

Public Function NewEnum() As IUnknown
    Set NewEnum = m_Employees.[_NewEnum]
End Function

并在过程属性中,将过程id设置为-4,如下所示: enter image description here

参考:http://www.vb-helper.com/howto_custom_collection_with_for_each.html