Visual Basic 6 designers have a number of built-in user interface tools at their disposal, yet many developers abuse these advantages and create cumbersome, convoluted GUIs. Below are a few simple guidelines to keep your VB6 GUIs clean, straightforward, and intuitive, resulting in greater user satisfaction and fewer post-delivery revisions.
Develop proper forms
Forms don’t usually get much attention from code-level developers. We add a form and off we go, plugging in various controls and using them as containers for information. But setting up forms’ properties is important for creating visually pleasant, consistent, and intuitive interfaces.
You should specify the proper border style of a form. Your options are:
- Fixed Single
- Fixed Dialog
- Fixed ToolWindow
- Sizable ToolWindow
Using None is rarely a good idea, since such forms don’t have a title bar or the control menu box, so users can’t close or resize them. The default form value is Sizable (allowing users to resize the form), but this is a good choice only in cases where all the form elements are designed to resize along with the form itself.
The Fixed Dialog style offers a border and doesn’t allow a form to be resized, but it lacks Minimize and Maximize buttons in the top-right corner. To include those buttons, use the Fixed Single style. Sizable ToolWindow and Fixed ToolWindow styles are generally used for forms that need to float over and allow changes to be made to the main forms.
You should also address the form’s start position. The available start position styles are:
- Windows Default
The default style is Manual, which means that the form will appear in the same location at both runtime and design time. Windows Default puts a form in the upper-left corner on the screen. CenterScreen places a form in the center of the user’s screen regardless of the screen resolution. CenterOwner places a form in the center of the owner form. An owner is a form on top of which the current form is to appear. When no owner is specified, the form shows up in the center of the desktop.
Keep controls consistent and appropriate
Before simply dropping controls on a form, consider what kind of data the control will oversee and how your users will interact with that data. The guidelines provided below will help you choose the best controls for a particular type of data.
The first rule of form controls is that they should have consistent characteristics, such as look, feel, and size. Users shouldn’t need to learn specific visual cues and usage parameters for each control.
Your text box controls should be the same height as the combo boxes. By default, the height property of text boxes is different from that of the combo boxes. You should change the height value of the text boxes to match that of the combo boxes (since the height property is read-only in combo boxes). Obviously, this rule applies only to single-line text boxes.
You should use the proper controls for the data you need to display. If you’re displaying read-only data, you should not use a text box and modify its properties so that users can’t make changes to its text. Instead, use a label. Text box controls should be used only for editable data.
When you need to display fewer than five options in a list and you want the user to choose only one item, option buttons are your best choice. Many applications use combo boxes to display such information, but from the user’s standpoint, it’s much better to see all options at once rather than having to scroll through the listings in a combo box.
Keep in mind that when you want your users to be able to select more than one item from a small list of selections, using check boxes is a good idea. As with option buttons, check boxes let users see all options available at the same time, but check boxes also allow the selection of multiple items from the list.
When you need to display a larger number of items for users to choose from, it’s not feasible to use option buttons or check boxes because of the amount of real estate they would take up on the form. In such cases, you should display data either in combo boxes or list boxes to save space. You can use multiple-selection list boxes to let users select more than one item at a time; combo boxes allow only one item to be selected.
Developers sometimes use combo boxes and list boxes to display more than one column of data; however, grid controls may be easier for users to understand (and easier for you to code).
When using labels next to corresponding controls, left-align the labels and follow label captions with a colon for better readability. Also, align labels vertically to the corresponding controls. Figure A provides an example of these label rules in action.
Always set the BackStyle property of label controls to Transparent to make sure your labels have the same BackColor as the parent form.
Whenever you need to prevent users from using a control temporarily, it’s preferable to disable the control rather than hide it. Disabling a control prevents the user from clicking it, but it doesn’t significantly alter the way the form looks. Hiding controls may take your users by surprise or lead them to believe that something is wrong with an application. When selecting controls, also consider newer VB options, such as Tab Control, Tree View, Progress Bar, and Toolbar, to improve the form layout and design.
It’s a generally accepted practice to follow Windows standards for menus in applications. Whenever possible, use the standard Windows menu names and captions and provide submenus that are consistent with Windows conventions. To see these standards in action, just open up any Office application and go through the menu and submenu lists. Also, to improve the user’s experience with the application, consider developing shortcuts. Try to match the shortcut keys to those used in Windows applications to keep the intuitive appeal high.
Keep it clean
Developers are not immune from user interface concerns. Holding to certain coding standards will save time and trouble during user testing and will likely keep your applications (and you) in service longer.
Subscribe to the Developer Insider Newsletter
From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays