The document discusses best practices for using multiple forms in a Visual Basic .NET application, including:
1. Using templates to create splash screens and about boxes that provide information to users.
2. Displaying and hiding forms using methods like Show, ShowDialog, and Hide.
3. Declaring variables with the appropriate scope and access level to make them available across multiple forms.
4. Handling events like Load and Activated that occur when switching between forms.
19. Setting the Splash Screen Example Set the Splash screen drop-down list to the new form in the Project Designer
20.
21.
22.
23.
24.
25.
26.
27. The Sequence of Form Events Occurs after the form is closed FomClosed Occurs as the form is about to close FormClosing Occurs when the form is no longer the active form Deactivate Occurs each time any portion of the form is redrawn Paint Occurs each time the form is shown Activate Occurs before the form is displayed for the first time-usually happens only once Load
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
Notas do Editor
Brief description on how to navigate within this presentation (ppt) The first time a Key Term from the chapter is used in the ppt it will display in blue Gold colored text boxes display coding examples Slides will be numbered (# of #) when multiple slides on same topic (Slide title) Speaker notes are included where appropriate for slides (*)Denotes either a comment for page reference to textbook or slide reference in ppt
The new form will display on the screen and be added to the Solution Explorer Window
The Solution Explorer window shows the files that are included in a project-you can add new files and remove files from a project
About boxes typically hold labels and perhaps an image or shape controls for a logo *The new slide shows an example of a typical About box
A typical About box that contains labels, a group box, a picture box, and a button – [suggestion: have students identify each label, group box, picture box and button]
A new form created with the About Box template. The form can be customized by setting properties of the controls, adding controls, or removing controls.
*The Assembly Information dialog box displays on the next slide
Enter or modify the project’s information on the Assembly Information dialog box Once the information is entered into the Assembly Information , it can be retrieved by using the My.Application object.
*The next slide displays a custom splash screen created from a standard Windows form
The predefined code in the splash screen template may be more complicated than is needed- it includes code to fill in the application title, version, and copyright information from the project’s assembly information
Whether you create your own splash screen or use the VB template, you must take one more step to make the splash screen appear before the startup form
In code, you can use several methods to show, hide, and close forms
Even with a modal form, the user can switch to another application within Windows
Form handling in VB .NET 2005 is significantly different than form handling in VB .NET 2003 and earlier versions. VB 2005 automatically creates a form object for each of the form classes that you create. You can show, hide, and close forms without explicitly declaring a new object. This default form object is not actually instantiated until you access one of the form’s objects (such as a text box) or a form method (such as the Show method).
It’s helpful to know the order in which the form events occur
Double-clicking a control or form opens an event procedure called FormName.Load-there are two easy techniques in addition toe double-clicking
Public keyword is not considered a good programming practice Local and block level variables are declared inside a procedure and are always private
Using a static local variable is better than using a module level variable because it is always best to keep the scope of a variable as narrow as possible
There are general guidelines for helping to decide where to place declarations *Refer to p. 260 for the Declaration Summary for Variables and Constants table