Paul S. Cilwa

Accelerated VB 6

If you are disappointed that the Visual Basic course you just took did not prepare you for creating actual applications, you aren't alone. But you don't need to start from scratch. In my Accelerated Visual Basic course, programmers who already know the basics of Visual Basic syntax and operation of the VB development environment can spend a week learning  how to create real business applications, including database access and the creation of a finished setup / deployment package.

And, as always with my courses, the student will leave with a firm foundation of Object Oriented Programming techniques.

Course Duration

Five days.

Prerequisites

These prerequisites can be met by studying the online materials through to "Controls".

  • Ability to program in any language
  • At least six months’ experience with Windows 95/98/NT 4.0+
  • 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
  • Know how to
  • Start Visual Basic
  • Set IDE options
  • Set project properties
  • Create a stand-alone executable
  • Use the Object Browser
  • Work around the Form Layout View bug
  • Display messages to the end user (MsgBox)
  • Create Dynamic controls
  • Write custom properties and methods
  • Understand
  • Visual Basic identifier syntax
  • The types of Project modules
  • Lifetime and scope of variables
  • Available data types
  • Arrays (Static and dynamic)
  • Constants
  • Enumerated constants
  • Event handling
  • Common control properties
  • Form events
  • Control arrays
  • Forms as objects

Outline

Working with Applications

We 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.

  • The six application types (and which interface to use with each)
  • Document-centric applications
  • Using the Visual Basic menu editor correctly
  • Modal vs. modeless forms
  • Implementing context-sensitive, online help
  • The Common Dialog control
  • Implementing the Help menu commands

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
  • 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 Storage

Next, 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.

This section may be omitted, if necessary, in the interests of time if the client prefers more emphasis on database than on file I/O.

  • 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!)

Working with Dialogs

Working with Templates

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 Databases

Most business applications access information in databases to do their work. Visual Basic makes it easy to do this, but offers a dizzying array of choices to assist: Direct functional (API) access vs. the Data control; ADO vs. DAO vs. ODBC and more. In this section we make sense of the choices and students learn how to intelligently pick and use one.

Each company has its own database access requirements. Some use Oracle; some use SQL Server or DB2 or Access or others. Once the company has supplied the class with a Connect String we can make use of that database in the class. since Visual Basic database techniques mask the differences between database types.

  • Brief database overview
  • The Data Control
  • OLE DB vs. ADO vs. RDO vs. DAO vs. ODBC: History and choices
  • Direct function calls as an option: pros and cons
  • Data controls vs. database objects
  • The object hierarchy: Connection, Command, Recordset, Record and Stream objects
  • Using Data Bound controls
  • Using the Data Bound List Controls
  • Using the DataGrid, FlexGrid and Hierarchical FlexGrid controls

Working With Reports

  • Options for VB Programmers: By hand, Visual Basic DataReport objects, Crystal Reports, other third-party report writers
  • How to connect Crystal and other third-party report writers to your VB application
  • Using the DataReport object

Working With Deployment

Finally, your application is complete. How do you get it to the end user? The days are long past us when you could copy your .EXE onto a floppy and fling it into the next cubicle. Users want, and Windows requires, a robust, sturdy Setup program that accommodates the updating of DLLs, interacting with Explorer to create menu and desktop shortcuts, updates the system Registry, and—most important of all—provides a mechanism for clean removal of applications after setup. In this final section, we learn to make this happen.

  • The Setup and Deployment Wizard: Disadvantages
  • How to obtain Microsoft Visual Studio Installer
  • Starting Visual Studio Installer
  • Customizing the dialogs
  • Creating a Read Me file
  • Creating desktop and menu shortcuts
  • How to decide which files go into what folders
  • Alternate setup programs
  • Creating an AutoRun CD for your solution