|
-
Nov 24th, 2003, 11:51 AM
#1
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:
Private Sub Form_Load()
'make frame background colors coordinated
For Each Frame In Form
Frame.BackColor = RGB(255, 255, 255)
Next
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|