Learning MicroStation VBA

Chapter 20: Class Modules

Overview

Class modules have a variety of purposes with these primary beneficial uses:

  • To encapsulate similar functionality into a single object.

  • To create an object with properties, methods, and events.

  • To create class modules specifically for custom collections.

Each benefit will be the focus of a section in this chapter. The code we write will target the use of the MicroStation Built-in dialog boxes and other MicroStation-specific objects and functionality.

Encapsulating Similar Functionality

We can design classes with the intent to encapsulate similar functionality in a single class or object so we can reuse our code, which is faster than rewriting code. Let's begin with a class named clsUStationDialog that will be used to display the dialog boxes used in the chapter for FileOpen and FileCreate.

Before we begin looking at the code, let's identify what we want this class to do.

  • Display File Open Dialog for MicroStation DGN files.

  • Display File Open Dialog for Microsoft Excel files.

  • Display File Open Dialog for ASCII .txt files.

  • Display File Open Dialog for custom file extensions.

  • Property needed for File Name.

  • Property needed for Path Only.

  • Property needed for Path / File Name.

  • Property needed for Size of selected File.

  • Registry Entries to be used to store most recent path.

  • Registry Entries to be used to store most recent file.

You have accomplished each of the desired tasks already in this book. The focus of this exercise will be to wrap it all into a single class.

We want to display...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: File Compression Software
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.