You can select multiple controls at the same time by holding down the shift key when you select the second and subsequent controls, even controls of different types. The Properties window shows just those properties common to both, so you can set them all to the same size, color and text fields etc. Even the same event handlers can be assigned to multiple controls.
Depending on the use, some forms will often end up being resized by the user. Nothing looks worse than resizing a form and seeing controls stay in the same position. All controls have anchors that let you "attach" them to the 4 edges so that the control moves or stretches when an attached edge is moved. This leads to the following behavior when a form is stretched from the right edge:
- Control Attached to Left but not right. - It Doesn't move or stretch (bad!)
- Control attached to both left and right edges. It stretches when the form is stretched.
- Control attached to right edge. It moves when the form is stretched.
For buttons like Close which are traditionally in the bottom right, behavior 3 is what is needed. ListViews and DataGridViews are best with 2 if the number of columns is enough to overflow the form and needs scrolling). The Top and Left anchors are the default. The Property Window includes a nifty little editor that looks like the England Flag. Just click any of the bars (two horizontal and two vertical) to set or clear the appropriate anchor, as shown in the picture above.
One property that doesn't get much mention is the Tag property and yet it can be incredibly useful. In the Properties Window you can only assign text but in your code you can have any value that descends from Object.
I've used Tag to hold an entire object while only showing a few of its properties in a ListView. For instance you might only want to show a Customer Name and number in a Customer Summary list. But right click on the selected customer and then open a form with all the customer's details. This is easy if when you build up the customer list by reading all customer's details in memory and assigning a reference to the Customer Class Object in the Tag. All controls have a Tag.
On the next page: How to work with TabControls