In Visual Basic, the form is the container for all the controls that make up the user interface. When a Visual Basic application is executing, each window it displays on the desktop is a form. The terms form and window describe the same entity. A window is what the user sees on the desktop when… [Continue Reading]
Working with Forms
Properties of the Form Object – Forms in Visual Basic 2008
You’re familiar with the appearance of forms, even if you haven’t programmed in the Windows environment in the past; you have seen nearly all types of windows in the applications you’re using every day. The floating toolbars used by many graphics applications, for example, are actually forms with a narrow title bar. The dialog boxes… [Continue Reading]
Placing Controls on Forms – Visual Basic 2008
The first step in designing your application’s interface is, of course, the analysis and careful planning of the basic operations you want to provide through your interface. The second step is to design the forms. Designing a form means placing Windows controls on it, setting the controls’ properties, and then writing code to handle the… [Continue Reading]
Setting the TabIndex Property of a Form – Visual Basic 2008
Another important issue in form design is the tab order of the controls on the form. As you know, pressing the Tab key at runtime takes you to the next control on the form. The order of the controls is the order in which they were placed on the form, but this is never what… [Continue Reading]
An Example Contacts Project using Forms in Visual Basic 2008
This section discusses a simple data-entry application that demonstrates many of the topics discussed here, as well as a few techniques for designing easy-to-use forms. Figure 5.4 shows a data-entry form for maintaining contact information, and I’m sure you will add your own fields to make this application more useful. You can navigate through the… [Continue Reading]
Anchoring and Docking Controls to a Form in VB 2008
A common issue in form design is the design of forms that are properly resized. For instance, you might design a nice form for a given size, but when it’s resized at runtime, the controls are all clustered in the top-left corner. Or a TextBox control that covers the entire width of the form at… [Continue Reading]
Splitting Forms into Multiple Panes – Visual Basic 2008
The form behaves better, but it’s not what you really expect from a Windows application. The problem with the form in Figure 5.7 in the section “Anchoring and Docking Controls to a Form” is that users can’t change the relative widths of the controls. In other words, they can’t make one of the controls narrower… [Continue Reading]
The Form’s Events – Visual Basic 2008
The Form object triggers several events. The most important are Activated, Deactivate, Form-Closing, Resize, and Paint. The Activated and Deactivate Events When more than one form is displayed, the user can switch from one to the other by using the mouse or by pressing Alt+Tab. Each time a form is activated, the Activated event takes… [Continue Reading]
Loading and Showing Forms – Visual Basic 2008
Most practical applications are made up of multiple forms and dialog boxes, and one of the operations you’ll have to perform with multiform applications is to load and manipulate forms from within other forms’ code. For example, you might want to display a second form to prompt the user for data specific to an application…. [Continue Reading]
Controlling One Form from within Another – Visual Basic 2008
Loading and displaying a form from within another form’s code is fairly trivial. In some situations, this is all the interaction you need between forms. Each form is designed to operate independently of the others, but they can communicate via public variables (see the following section). In most situations, however, you need to control one… [Continue Reading]