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 … [Read more...] about The Appearance of Forms
Working with Forms
Properties of the Form Object
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 … [Read more...] about Properties of the Form Object
Placing Controls on Forms
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 … [Read more...] about Placing Controls on Forms
Setting the TabIndex Property of a Form
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, … [Read more...] about Setting the TabIndex Property of a Form
An Example Contacts Project using Forms
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 … [Read more...] about An Example Contacts Project using Forms
Anchoring and Docking Controls to a Form
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 … [Read more...] about Anchoring and Docking Controls to a Form
Splitting Forms into Multiple Panes
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. … [Read more...] about Splitting Forms into Multiple Panes
The Form’s Events
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 … [Read more...] about The Form’s Events
Loading and Showing Forms
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 … [Read more...] about Loading and Showing Forms
Controlling One Form from within Another
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 … [Read more...] about Controlling One Form from within Another
Forms versus Dialog Boxes
Dialog boxes are special types of forms with very specific functionality, which we use to prompt the user for data. The Open and Save dialog boxes are two of the most familiar dialog boxes in Windows. They're so common that they're actually known as … [Read more...] about Forms versus Dialog Boxes
The MultipleForms Example
It's time to write an application that puts together the most important topics discussed in this section. The MultipleForms example consists of a main form, an auxiliary form, and a dialog box. All three components of the application's interface are … [Read more...] about The MultipleForms Example
Building Dynamic Forms at Runtime
Sometimes you won't know in advance how many instances of a given control might be required on a form. Let's say you're designing a form for displaying the names of all tables in a database. It's practically impossible to design a form that will … [Read more...] about Building Dynamic Forms at Runtime
Creating Event Handlers at Runtime
You saw how to add controls on your forms at runtime and how to access the properties of these controls from within your code. In many situations, this is all you need: a way to access the properties of the controls (the text on a TextBox control or … [Read more...] about Creating Event Handlers at Runtime
Menu Editor, Designing Menus
Menus are among the most common and most characteristic elements of the Windows user interface. Even in the old days of character-based displays, menus were used to display methodically organized choices and guide the user through an application. … [Read more...] about Menu Editor, Designing Menus
The ToolStripMenuItem Properties
The ToolStripMenuItem class represents a menu command, at any level. If a command leads to a submenu, it's still represented by a ToolStripMenuItem object, which has its own collection of ToolStripMenuItem objects: the DropDownItems collection, which … [Read more...] about The ToolStripMenuItem Properties
Manipulating Menus at Runtime
Dynamic menus change at runtime to display more or fewer commands, depending on the current status of the program. This section explores two techniques for implementing dynamic menus: Creating short and long versions of the same menuAdding and … [Read more...] about Manipulating Menus at Runtime
Iterating a Menu’s Items
The last menu-related topic in this chapter demonstrates how to iterate through all the items of a menu structure, including their submenus, at any depth. The main menu of an application can be accessed by the expression Me.MenuStrip1 (assuming that … [Read more...] about Iterating a Menu’s Items