Marietto Marietto - 2 years ago 119
Vb.net Question

array of objects inside a collection

I'm trying to understand how to use an array of objects together a collection, but I can't understand.

Dim col As New Collection

Dim ObjArray(3) As Object
ObjArray(0) = chapter
ObjArray(1) = paragraph
ObjArray(2) = voice

collezione.Add(ObjArray)


This is my declaration. I don't know how many objects there are inside each field in ObjArray.
I want to do a For to check every value inside ObjArray, but how can I loop?

Answer Source

Cycle through your array and add each item to the collection

    For position As Integer = 0 To ObjArray.Length - 1
        col.Add(ObjArray(position))
    Next
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download