JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Creating Panels

When you add radio buttons to a form, they are automatically coordinated so that only one radio button can be selected at a time. If the user selects a new radio button, all the other options buttons are automatically deselected. But there are times when that's not convenient; for example, you may have two sets of options buttons: day of the week and day of the month. You want the user to be able to select one radio button in each list. How do you group radio buttons together into different groups on the same form?

You can use the panel or group box controls. Inside either of these controls, radio buttons will act as though they were in their own group, and the user can select one radio button in each group, as shown in Figure 6.4.

You can create panels at design time or run time; for example, I'm creating panels in Figure 6.15 at design time. Here, I've set the panels' BorderStyle property to Fixed3D. (The other possibilities are None, which is the default, and Fixed Single.)

Click To expand
Figure 6.15: Grouping radio buttons together using panels.

Panels support scroll bars, which group boxes do not. To enable scroll bars in a panel, set its AutoScroll property to True. You also can customize the panel's scrolling behavior with the AutoScrollMargin and AutoScrollMin Size properties.

After you've created a panel, you can add controls to it; at design time, the controls will then become part of the panel, and when you move the panel, the contained controls will move as well. For an example showing how to add controls to panels in code, see the next topic.

Previous Section Next Section

JavaScript Editor Free JavaScript Editor     JavaScript Editor