Data
processing projects that once required a team of 50 COBOL programmers two years
to write, are now being replaced by Visual Basic systems written in a few weeks
by a single programmer.
How is this possible? Simply, by using the combined power of object-oriented programming and the object-oriented features of the Microsoft Visual Basic programming language. You, too, can learn to achieve this mind-blowing efficiency by participating in this five-day, introductory-level course.
Five days.
Most corporate Visual Basic classes are given in three days, and teach Visual Basic syntax and how to use the Visual Basic Integrated Development Environment. Students leave these classes having no concept of what goes into creating a viable Windows application, and usually having learned little or nothing about object-oriented programming. This course does not have these limitations!
- Understand the file structure
- Be able to create, copy, and delete files with Explorer
- Be proficient with drag-and-drop operations
- Be familiar with the standard Windows applications menu
Working with the IDE
We begin the course by starting up Visual Basic, examining the Visual Basic IDE (Integrated Development Environment), and learning how to adjust a number of options to enhance the programmer's productivity.
- Visual Basic vs. VBA
- Visual Basic purchase options
- Starting Visual Basic
- New project options
- The Immediate window
- Setting IDE options
Working with Projects
We then create a new project, the MDI Skeleton, which we will continue to build throughout the course.
- Setting project properties
- Visual Basic identifier syntax
- Using the Project Explorer
- Working around the Form Layout View bug
- Managing project modules
- Saving and Testing your project
- Creating a stand-alone executable
Working with Modules
Modules are the building blocks of every Visual Basic application.
- Understanding Modules
- Module names
- Using the Code Window
- Syntax of Literals
- Lifetime and Scope of Variables and Constants
- Data Types
- Visual Basic Statements
- Subroutines
- Passing arguments
- Flow-of-control Statements
- Operators
- Built-in Statements
- Using the Object Browser
- Documenting Modules
Working with Forms
In this chapter, the students begin a reusable, combination About box and Splash Screen that can be used by this project and any other.
- The difference between a form's appearance and its behavior
- Interface terminology
- Using the Form Templates
- Properties and the Property Window
- Important Form Properties
- What is a Twip?
- Setting the Startup Object
Working with Colors and Graphics
Use of color and graphics in an application is not frivolous: It makes use of solid psychological principles to help end users become more productive and increase accuracy.
- Managing colors
- User-selected vs. Palette Colors
- Four kinds of bitmaps: How to choose
- Optimizing bitmaps for efficiency
- Icons and Metafiles
- Using transparent areas
- Recommended use of Icons
Working with Controls
Controls are the basic components of every form in Visual Basic. Understanding how to use them to their greatest potential is essential for a successful application.
- Definition of a Control
- Placing Controls on a Form
- Common control properties
- Working with the standard controls: Label, Text, Picture, Image, etc.
- Control arrays
- Dynamic controls
- Locking Controls on a Form
- Correct use of TabIndex Property
Working with Events
Events allow Visual Basic objects to proactively communicate with the components that own them. From the Click event of a button, to the Timer event of a Timer control, these events are the backbone of Visual Basic programming.
- Definition of Events
- Form events
- Tracking Events
- Displaying messages to the end user
- The App object
- Understanding Default Properties
- The With Block
Working with Objects
Visual Basic is the most-used object-oriented language in the world; to ignore the object-oriented aspects of it is to abandon 80% of its power.
- Using Objects
- Definition of Classes
- Object Interfaces
- Object Implementations
- Properties, Events and Methods
- Object Syntax
- Forms as objects
- How to Design an Object
- Project Components
- The ProgressBar Control
- Writing Property Procedures
- Property Procedures vs. Property Variables
- Modal vs. Modeless Dialogs
- Display a Modeless Dialog
- Making Objects Reusable
Working with Applications
Now that the student has had a chance to play with Visual Basic's most obvious features, it's time to develop a real application, with all the complexity and subtlety of a commercial Windows application. This chapter introduces the MDIForm, the frame window for a typical, multiple-document-interface application.
- Designing an Application
- The Six Application Types (and which interface to use with each)
- The Windows Programming Challenge
- Single Document Interface
- Multiple Document Interface
- Interface Terminology
- Document-Centric Overview
- MDI App Design
- Adding An MDI Form
- Displaying a Splash Screen
- Setting the Startup Size
Working with Menus
This chapter teaches the student how to make the most of the (miserable!) Visual Basic Menu Editor.
- How to create menus with the menu editor
- How to document menu commands
- Adding a menu command event handler
- Displaying modal dialogs in response to a menu command
Working with Code
This chapter examines Visual Basic syntax: data types and built-in functions, and demonstrates their use by building a reusable object class.
- Code modules
- Lifetime and scope of variables
- Available data types
- Arrays (Static and dynamic)
- Constants
- Enumerated constants
- Objects: How they are implemented
- The automatic reference count
- Classes vs. objects
- The Public and Private keywords
- Methods and properties
- Property procedures
- Using the Class Builder
- Creating read-only and write-only properties
- Flow-of-control statements
- Conditions
- Implementing "overloaded" procedures with Variant arguments
- Optional arguments
- Using the File System Object
Working with Exceptions
Exception handling in Visual Basic is one of its great strengths; it makes it possible for the programmer to write optimistic code, and yet never miss an error!
- The call stack
- The On Error and Resume statements
- The Err object
- Making hierarchical error trapping work for you
- In-line error checking
- Using the common File Open dialog
Working with Views
In the Multiple Document Interface, each window into a document's data points is called a view. In this chapter, we create a typical view and integrate it into the MDI Skeleton.
- Creating and showing MDIChild forms
- Form arrays
- Undocumented trick: Copying a menu from one form to another
- Delegating menu handling from one form to another
- Implementing the Window menu view arrangement commands
Working with Strings
The string handling in Visual Basic is probably the most powerful, and easy to use, in any computer language. We learn the basics in this chapter.
- Declaring strings
- Variable-length, fixed-length, and empty strings
- Substrings and concatenation
- String searches
- String conversions
- Automatic data conversions
- The built-in Format function
- Formatting numbers, dates and times
Working with Documents
Virtually all commercial Windows applications are document-centric, and the Document class supplies the object that encapsulates an application's data points. We design and implement one in this chapter.
- Adding a class module without using Class Builder
- Supporting a collection of Views
- Integrating the Frame, the Filename, and the View
- Exploring the link-back concept
- Implement File..Save and File..Save As
- Tracking document modifications
- Prompting for permission to close
Working with Collections
Next to strings and data-bound controls,, the built-in Collection class is probably Visual Basic's most powerful and valuable feature. In this chapter, we explore the Collection class by building a custom one, incidentally adding the "multiple" to MDI Skeleton's multiple-document capability.
- The concept of aggregation
- The Collection Builder
- The two approaches to implementing a collection's Add method
- The NewEnum property (and quirks)
- Iterating collection elements
- Testing for duplicate keys
- Activating another view
Working with Templates
Time permitting. An MDI Skeleton isn't much use if it can't be easily accessed for reuse. This chapter shows where the Visual Basic form and project templates are kept, and shows how to prepare modules for inclusion with the other templates.
Working with Storage
Finally, we build into MDI Skeleton the ability to open and read, write and close data files. Even though we don't know at present the details of the file type applications derived from the skeleton, we can use simple text I/O as a placeholder.
- Visual Basic-supported file types
- User-defined data types and structured storage
- File I/O statements
- Adding properties to the Document to separate the data and the View
- Visual Basic-supported Clipboard formats
- Enumerating supplied formats
- Placing and retrieving clipboard data
- Implementing the Edit menu clipboard commands
- Database processing
- The Data control
- Data-bound controls
- Demo: A simple, five minute, database application (no keyboard needed!)