Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Relocate multiple controls.

Status
Not open for further replies.

BirdieNamNam

Programmer
Feb 12, 2004
52
0
0
SE
Hello, dear friends!

I have a form. In the top part of the form there are a number of controls. These top controls can be shown/hidden by the user (in a menu).

Below the optional controls there are many more controls. If the user choses to hide the top control, I want all the other controls to move up so they fill the form anyway.

My question is, is there any shortcut to do this. Can I collect them in some kind of collection, and move them all simultaniosly, or must i write .top= for each and every control?

Best regards, Sebastian.
 
You can use the Controls collection:

Dim c As Control
For Each c In Controls
c.Top = c.Top - 500
Next c


or you could place all the 'to-be-moved' controls in a frame and move the frame.

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Hello John! Thanks for your answer.

The "controls" collection will contain all my controls, right? Or is there a way to create my own collection of controls, and only include the once I want to manipulate?

And for the frame solution, is there any way to not make the frame itself visible? Then that would be a nice solution...

Thanks again, Sebastian.
 
>is there any way to not make the frame itself visible?

Set the BorderStyle property of the frame control to 0 (None).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top