Results 1 to 3 of 3

Thread: For each...next within for each...next

  1. #1
    100 Club
    Join Date
    2007-07
    Posts
    104
    Login to Give a bone
    0

    Default For each...next within for each...next

    A program I made up has a very long for each statement. Somewhere within the for each..next procedure, a block is made. But sometimes the block is made twice (on a crosspoint in the drawing).
    I want to avoid this, but the only way I can think of, is by making a "for each" statement within the first" for each" statement, that skips to the "next" statement of the first one if the blockname already exists. But that seems clumsy, and I'm not even sure if it's possible. Anybody have a good way to handle this situation?

  2. #2
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,420
    Login to Give a bone
    0

    Default Re: For each...next within for each...next

    Clumsy is kind of relative. You need a set of logic to define the conditions under which an event happens. You could try to define all the conditions up front, but then you have to apply that logic to every descision. Its better to keep the logic as simple as possible and apply it only where its needed.
    C:> ED WORKING....


    LinkedIn

  3. #3
    Active Member
    Join Date
    2007-12
    Posts
    68
    Login to Give a bone
    0

    Default Re: For each...next within for each...next

    you also have to be careful when looping thru collections ... the collection can update on you as you add/delete entities, because by doing so, you are changing the collection.

    Loop thru the collection once, grab the handle/ObjectIDs that interest you, then go back in a separate loop and do your modifications.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •