Home All Groups Group Topic Archive Search About

Question: comparsion or flag

Author
25 Jul 2006 9:23 PM
dotnetnoob
let's say i have a arraylist that contain 1 1 0 1

this arraylist serve as a flag if the value inside the arraylist is 1 then
that mean it's on and if it's 0 then it's off

so i got this code

Dim i, a As Integer
        i = arlsYN.Count
        a = 0

        Do Until a = i

            If CInt(arlsYN.Item(a)) = 1 Then
              'do something

            Else
                it should move to the next item in the arraylist but i don't
know how to do this
            End If
            a += 1
        Loop

how do i move to the next item in the arraylist if the value come up as 0
and it is not equal to 1, i want the arraylist to move to the next item if it
encounter item with 0 value in it.

thank

Author
25 Jul 2006 10:18 PM
tommaso.gastaldi
Dim a As New ArrayList(New Integer() {1, 1, 0, 1})

        For Each flag As Integer In a

            If flag = 0 Then Continue For

            MsgBox("flag is 1")

        Next flag


-tom


dotnetnoob ha scritto:

Show quoteHide quote
> let's say i have a arraylist that contain 1 1 0 1
>
> this arraylist serve as a flag if the value inside the arraylist is 1 then
> that mean it's on and if it's 0 then it's off
>
> so i got this code
>
>  Dim i, a As Integer
>         i = arlsYN.Count
>         a = 0
>
>         Do Until a = i
>
>             If CInt(arlsYN.Item(a)) = 1 Then
>               'do something
>
>             Else
>                 it should move to the next item in the arraylist but i don't
> know how to do this
>             End If
>             a += 1
>         Loop
>
> how do i move to the next item in the arraylist if the value come up as 0
> and it is not equal to 1, i want the arraylist to move to the next item if it
> encounter item with 0 value in it.
>
> thank