-
Dec 7th, 2013, 07:21 PM
#1
Thread Starter
PowerPoster
Subtract 30 from all controls on form - their height and top positions?
Hi there everyone I am finishing up another math game, and I was wondering if there was a quick way to subtract 30 from all of the objects on the forms top position, and 30 from their height attribute?
Thank you so much!!!
-
Dec 7th, 2013, 07:30 PM
#2
Thread Starter
PowerPoster
Re: Subtract 30 from all controls on form - their height and top positions?
All of the objects are frames, labels, and shapes if that makes a difference?
-
Dec 7th, 2013, 07:33 PM
#3
Re: Subtract 30 from all controls on form - their height and top positions?
Cicle for each control in Me.Controls collection and change their values as you want.
Last edited by gibra; Dec 8th, 2013 at 06:36 AM.
-
Dec 7th, 2013, 07:40 PM
#4
Thread Starter
PowerPoster
Re: Subtract 30 from all controls on form - their height and top positions?
Ok, lets say for ex I just wanted to subtract from 1 frame.
Would I put
Frame1.height = val(Frame1.height) - 30
???
-
Dec 8th, 2013, 12:39 AM
#5
Re: Subtract 30 from all controls on form - their height and top positions?
you do not need to use val() height is a numeric value and thus does not need converted
-
Dec 8th, 2013, 11:50 AM
#6
Re: Subtract 30 from all controls on form - their height and top positions?
Calling Val() is almost always a weird choice anyway. It uses the "invariant locale" so depending on your regional settings it may not do what you expect. Of course that assumes you are using it to parse a String to a Double value... which is what it is for.
In this case the height (which is Single) gets implicitly converted to a String because Val() needs a String argument, and then converted back to a Double (which Val() always returns).
This could fail since implicit conversions are locale-aware while Val() uses the invariant locale.
So it is both absurd and buggy to do this sort of thing.
-
Dec 8th, 2013, 06:51 PM
#7
Re: Subtract 30 from all controls on form - their height and top positions?
you could subtract just like you did there. In practice, if you are moving labels and stuff around, it's easier to have all their positions stored in an array and you simply loop through the array and change that and then call a sub that draws them on screen based on that array.
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
|