Manage Controls

This project introduces the For Each / Next loop.

This powerful construct lets you iterate (loop) over a group of controls such as labels, buttons, and text boxes
that are on your form or in a group box, allowing you to manipulate those controls all at once. It is easiest to
manage controls when you place them all in a group box, and the syntax of the For Each loop in this case is:

For Each [control] in group box.Controls

For example, if there were a number of labels in a group box called grpMyLabels, the following code would
change all of the labels to display :) and be 100 pixels wide.
Dim myLbl as Label 'but this can be any kind of object (button,textbox,etc.)

For Each myLbl in grpMyLabels.Controls
myLbl.Text = ":)"
myLbl.Width = 100

Try it out!

Start a new project called ManageControls. On your form, create a START button, a RESET button, and a groupbox.
Create 6 buttons in the groupbox. Don’t worry what they look like, you’ll be changing that in the code.

Modify the buttons in your Form Load subroutine so they are all a little different and aren’t just standard, default
looking buttons. Don’t do this in the designer window! In your Form Load subroutine use a For Each loop to change
the buttons as follows:

• Change the width and height
• Change the Background color
• Change the font color
• Change the text
A Start button should do the following (remember to use the For Each loop again)
•Change each button to an image. Use your project resources to store and access image files.
•Change each background color to match the image.
•Change autosize to true.
•Remove the text on each button.
Use a Reset button to return everything to it’s initial (post-Form Load) configuration.

Extend your program

Extra Credit

Change the location of the buttons so that each one swaps location with another. Mix and match or just have pairs swap.
Make sure Reset returns the buttons to their original coordinates.