checkbox array, access through index

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #16
    That's not what you said in your first post. I still don't see what the indexing is for. You should still use the one loop approach. In your nested loops you are looping the controls 128 times. You only need to loop through them once.

    Comment

    • aatif
      New Member
      • Mar 2009
      • 28

      #17
      I am looping 128 times because I have to check 128 labels. I don't think that one iterator will accurately match both the labels (1 to 128) and the controls.

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #18
        You have 128 checkboxes labeled 1 .. 128 (in any order). You can loop through them all using one loop. Your foreach loop is redundant.

        Comment

        • aatif
          New Member
          • Mar 2009
          • 28

          #19
          ok, could you plz help me with the code? there is an array of 128 boolean values and I want to 'check' the checkboxes having label equal to the 'true' value's index.

          Comment

          • r035198x
            MVP
            • Sep 2006
            • 13225

            #20
            Originally posted by aatif
            ok, could you plz help me with the code? there is an array of 128 boolean values and I want to 'check' the checkboxes having label equal to the 'true' value's index.
            You keep changing your requirements. You never mentioned this array of 128 booleans before.

            Comment

            • aatif
              New Member
              • Mar 2009
              • 28

              #21
              :-| sorry if I forgot to mention exactly, thats why I needed to enlist them for easy acces for marking ...

              Comment

              • r035198x
                MVP
                • Sep 2006
                • 13225

                #22
                Better use a Map<int,boolean > (or do you .Netters call it a Dictionary<int, boolean>).

                Comment

                Working...