i’m using vb.net i have the following object array that i’m trung to extract all the true value from give it a name and add it to an array
here is the object array

this is what i have tried so far :
Dim myarray() As String
Dim number As Integer = 0
If resultArray(0).BolComment Then
myarray(number) = "comment"
number = number + 1
End If
If resultArray(0).BolComplete Then
myarray(number) = "complete"
number = number + 1
End If
If resultArray(0).BolFinished Then
myarray(number) = "Finished"
number = number + 1
End If
If resultArray(0).BolOutCome Then
myarray(number) = "OutCome"
number = number + 1
End If
If resultArray(0).BolStatred Then
myarray(number) = "Started"
number = number + 1
End If
If resultArray(0).BolUser Then
myarray(number) = "User"
number = number + 1
End If
this is giving me an error : the variable has been used before
Question how can i extract all the items that have the true value and push it to a new array with giving it a new name
Thanks
I think your problem is that you are not initializing the array to a specific size, nor are you re-sizing it each time you add a new item. However, it would be better to just use the
List(T)class:Then, if you need it as an actual array, do this: