[Search tip detail and code files using keywords, tip number, author name, etc ]
    For tip to function correctly, you must ensure that the downloaded file name matches the file name
    displayed in the Rename File To field. Please rename downloaded files when necessary.
Programming with Class, Pt. 2
Tip# CLIN1204 By Mike Tuersley On 01-Dec-2004
Rated By 1 users Downloaded : 504
Categories : Programmer's Tools, LISP Code Modules
Software type : AutoCAD
Rename File To : CADClinic_Dec04_Code
Code demonstrates use of the Class module.

Last month I introduced the Class Module (click here for column archives), and this month I am going to expand upon it. To refresh, a Class in layman's terms is a user-defined programming object. It is just like an internal VBA or AutoCAD object -- it can have properties, methods, and events.
I've started with the TitleBlock example from last month and have expanded it to include more functionality (figure 1). I couldn't talk my editor into posting all the code for the project within this document, so download the code from last month. It might help you to download the sample project now, so you have it loaded as you read this after opening the example, be sure to add references to Microsoft VBScript Regular Expressions v5.5 (or later) and Microsoft ActiveX Data Objects v2.8 Library (or later) if they are missing. This project also uses an Excel spreadsheet to store data, so you must change its location within the TitleBlock class module's Read_Excel function.

Example Project Scope
Last month, the code wrote the values stored by the class module to a text box to demonstrate how the class module worked. This month, the TitleBlock class has methods that will do a lot of the work for this project. Remember, one of the reasons for using class modules is to simplify your code. When completed, this class module can be sent to another programmer, and all he needs to do is add it and use it. He doesn't need to understand how to access an Excel spreadsheet through an ADO connection or how to retrieve the logged-in user's name through the Windows' API. To demonstrate, here is all the code from the basic module that runs this program



Average Rating:

User comments

Log In