Results 1 to 4 of 4

Thread: frames and foreach..next loop

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    frames and foreach..next loop

    ok, I have a form that has about 10 frames that are all different background colors so that when I'm editing the program I can see them easily.. when the form loads, I just do a .BackColor change, but I want to try using a For Each Next loop so that I don't have to have 10 lines of code when I could just put a loop that does it for me instead.. I tried it; but I couldn't get it to work, and I've never used For Each loops before in VB, so I don't know how I could get it working. This is what I have so far for it:

    VB Code:
    1. Private Sub Form_Load()
    2.   'make frame background colors coordinated
    3.     For Each Frame In Form
    4.       Frame.BackColor = RGB(255, 255, 255)
    5.     Next
    6. End Sub

    Is this even possible, or am I just running in the wrong direction or something? Also, I know I could easily just put in the extra lines of code.. but I want it to be automated.. because that's cool and stuff.. It's just one of those programmer things.. no reason to really do it; you just do it to make it be awesome.

    edit: oh, I forgot to mention.. it gives me a type mismatch error..
    Last edited by kows; Nov 24th, 2003 at 11:58 AM.
    Like Archer? Check out some Sterling Archer quotes.

Posting Permissions

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



Click Here to Expand Forum to Full Width