Hello,
Is it possible to use a for/next loop to automatically make changes to button properties?
This is the code I'm trying to make work:
For i as integer = 1 to 10
button (i).height = 10
next i
Thanks, Ken
For/Next loop Button Control?possible to control button properties with for/next loop?
Page 1 of 1
4 Replies - 2581 Views - Last Post: 14 April 2010 - 10:10 AM
Replies To: For/Next loop Button Control?
#2
Re: For/Next loop Button Control?
Posted 14 April 2010 - 09:18 AM
You can set the button height:
For i as integer = 1 to 10
button.height = i
next i
#3
Re: For/Next loop Button Control?
Posted 14 April 2010 - 09:32 AM
Thanks, but I'll clarify. I have 10 buttons that I want to have their height changed to say 10 pixels in height, or 50 pixels in height. Rather than having to type:
button1.height = 50
button2.height = 50
....
button10.height = 50
I was hoping there was a way to use a loop to do it automatically with a loop statement, because I have 10 buttons with 10 text boxes in 7 if statements, that all need to change size depending on the if conditions.
Thanks
button1.height = 50
button2.height = 50
....
button10.height = 50
I was hoping there was a way to use a loop to do it automatically with a loop statement, because I have 10 buttons with 10 text boxes in 7 if statements, that all need to change size depending on the if conditions.
Thanks
#4
Re: For/Next loop Button Control?
Posted 14 April 2010 - 09:37 AM
Is this what you're wanting
For Each btn As Control In Me.Controls
If TypeOf btn Is Button Then
CType(btn, Button).Height = 50
End If
Next
#5
Re: For/Next loop Button Control?
Posted 14 April 2010 - 10:10 AM
Awesome! that worked. Thanks so much.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote





|