Controls and Properties / Working with Multiple Controls
Subtitles of the Movie
In this movie I will demonstrate how you can affect multiple controls with a single mouse click. For example, if I draw some labels onto the form, for example three labels all at varying positions on the form with three corresponding text boxes in this manner. Now as you can see these labels and text boxes are not aligned properly and in most cases you would want these to be aligned. Well you could take care and manually physically line these up using the guides as a help but you could also do a much easier method and that is to select the item that you want to control by dragging a group around those controls. The item that is marked in the white box becomes your anchor. Then you can go to the Format menu and select Align Lefts and what that will do is align all the labels on that anchor. You could also with these items still selected you could go back into the Format Menu choose Make Same Size of Both which, these labels are already the same size, but if they weren't they would automatically become the same size. Let me demonstrate this on the text boxes as well. Again, begin by drawing, dragging and drawing around the text box, text boxes, Format Menu, Make Same Size Both. Now all the text boxes are the exact same size. With them still selected, Format, Align, Lefts, and they're all automatically aligned. You could also select the entire group of controls in one group and then select Format, Select Center and Form Vertically and that will place this entire group vertically centered in the form. You could do likewise Format, Center and Form Horizontally which in this case already there. You can also use this technique to delete unwanted controls. For example, highlight the entire group by simply dragging around them all and press the Delete Key. Be careful though when you delete items you are actually deleting them although there is an Undo, you click Edit, Undo that will bring those deleted controls back in this case. I'll delete these one more time and draw a couple of command buttons onto the form. And they will be of different size. If I wish to make both of these command buttons the same, I simply select, select which one I want to be the anchor, that is the one with the white boxes, click Format, Make Same Size, Both, they both become the size of Button 1. If I want to align them on their tops, then they'd become aligned based on the Button 1 top. If I were to deselect and then move one below the other and then reselect, Format, Align, Lefts, they'd become aligned on the selected item's left edge. As programs become more complex you'll find the usefulness of this multiple controls technique to come in very handy.
Tutorial Information
| Course: | Microsoft Visual Basic 2005 |
| Author: | Arthur Lee |
| SKU: | 33940 |
| ISBN: | 1-935320-10-6 |
| Release Date: | 2008-11-19 |
| Duration: | 7.5 hrs / 97 lessons |
| Work Files: |
Yes |
| Captions: | Available on CD and Online University |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |
VTC Sign up & Benefits
- Unlimited Access
- 81,350 Video Tutorials (20,800 free)
- Video Available as Flash or QuickTime
- Over 782 Courses
- $30 for One Month Access
- Multi-User Discounts Available
United States 