Alter all controls top variable in code (1 Viewer)

chrisjames25

Registered User.
Local time
Today, 03:18
Joined
Dec 1, 2014
Messages
401
Hi

I have a form that when i enter it via another form i would like the top control in it to become invisible and the rest of the controls move up the form by a hard coded number lets say 1cm.

Is there a way to achieve this without righting code for each and every control?

Cheers
 

Ranman256

Well-known member
Local time
Yesterday, 22:18
Joined
Apr 9, 2015
Messages
4,337
you are making too much extra work for yourself.
 

isladogs

MVP / VIP
Local time
Today, 03:18
Joined
Jan 14, 2017
Messages
18,216
Without knowing the reason for doing this, i'd agree with ranman

Hiding the first control is trivial.
In the form load event, add this line
Code:
 me.mycontrolname.visible=false
Substitute your control name in that line

More effort to shift the other controls.
Why is it important?
 

Mark_

Longboard on the internet
Local time
Yesterday, 19:18
Joined
Sep 12, 2017
Messages
2,111
Shifting each control's position UP by 1cm would be
Me.ControlName.Top = Me.ControlName.Top - 567

You would either need to do this manually for each control OR look at using the control collective to cycle through controls.

In all not a lot of benefit.

If you could do so though, put the control(s) you want to disappear into the form header, set their height =0 and disable them. Then set the header's height = header's height - 567. May do what you are looking for easier.
 

Users who are viewing this thread

Top Bottom