ArrayList HELP!!

Signo.X

Well-known member
Joined
Aug 21, 2006
Messages
76
Location
Australia
Programming Experience
1-3
Hello all ,

I'm trying to do the following :

VB.NET:
dim i as integer
dim ar as new ArrayList
 
ar.add(true)
ar.add(false)
ar.add(true)
ar.add(true)
 
for i = 0 to ar.count - 1 
 
' if the array contains TRUE values equivilant to a specific size do some thing..
 
if(ar.containts(true)) 
 
..... ' do some thing ..
 
end if

how do i check if the array contains TRUE values equevilant to a specific number, for examples how do i check that the array has 3 TRUE values????
Thanks in Advanced.
~signox.X
 
VB.NET:
dim bcount as integer
for each b as boolean in ar
  if b=true then bcount+=1
next
 
The ArrayList should almost never be used in VB 2005. Unless this is homework and you've been told to use an ArrayList you should be using a List(Of Boolean), which enforces that each item is a Boolean. The ArrayList can accept any type of object so, even if you intend for it to hold only Booelans, there's no way to enforce that.
 
Back
Top