user form and frame control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

in my user form i have 9 frames walking the user through the appropriate steps.

in the setup of the frames i am using the following code:

<BEGIN VB CODE>
counter = 0
For Each o In Me.Controls()
counter = counter + 1
If TypeOf o Is Frame Then
o.Move 0, 0, 306, 294
o.Visible = False
End If
Next
msgbox counter
<END VB CODE>

this code loops 79 times!!!

i created this form from scratch and added the frames one by one -
occasionally when dragging the frames around, one frame got put inside
another. i used CTRL+Z to undo the move.

any ideas why this would loop 79 times?
 
I assume you don't have 9 empty frames. You are looping once for each
control - so it wouldn't necessarily be surprising that you are looping 79
times.

Try this:

<BEGIN VB CODE>
counter = 0
For Each o In Me.Controls()
If TypeOf o Is Frame Then
counter = counter + 1
o.Move 0, 0, 306, 294
o.Visible = False
End If
Next
msgbox counter
<END VB CODE>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top