Build Class Properties - May 1998
Every time I create a new object I need to enter the Let, Get and declarations information for each property. So I created an add-in that builds the statements for me. Build Class Properties becomes the May 1988 Tip Of The month. Property names are entered on the following screen:
Build Class Property Entries
Property Name – The property name, EmployeeName, is entered in this text box. Click ‘Add to Clipboard’ to generate statements and add them to the clipboard. Generated statements are shown in the bottom text boxes. The prefix, ‘s’, is added to the name. The prefix changes when the ‘As Type’ changes. You can’t enter ‘blanks’ in the property name – they are ignored.
Prefix – The prefix is based upon the ‘As Type’. You can ‘override’ it by typing a new value in the prefix box. Better yet, edit the ‘As Type’ list.
Declarations Prefix – The declarations prefix is added to the property name when the declarations entry is created – ‘m_’ in this example. You can chance the prefix. It is saved in the registry for subsequent reuse.
Add vbTab – A tab is added to the declaration statement if this box is checked. Some people, me included, indent declared items. This value is saved in the registry.
Edit the ‘As Type’ List
Click the ‘Edit’ button to display the following dialog:
Add – Click ‘Add’ to add the newly defined type.
Delete – Click ‘Delete’ to delete an entry. If you delete all entries a new default set is created.
Update – Click ‘Update’ to change an entry.
Use of the Registry
Build Class Property session information is saved in the registry and restored the next time it is executed.
Using a VB Add-In to Launch An Application
I created TBBCP.DLL to launch TBBuildClassProperty.exe. You could use this sample code to launch any application from within the VB IDE.
Installing the TB Build Class Properties Add-In
VBAddin.Ini Entry – Run TBBuildClassProperty.Exe
The following entry is added to VBAddin.Ini the first time you execute TBBuildClassProperty:
You need to register TBBCP.DLL. This program is loaded when you instruct Add-In Manager to ‘use’ it. It in turn launches the ‘stand-alone’ TB Build Class Properties program. I have found the easiest way to register a DLL is to create a shortcut to RegSvr32.exe then drag the DLL onto the shortcut.
Launch the Add-In
Start VB. Select menu item Add-Ins, Add-In Manager. Check the TB Build Class Properties box. Click OK.
Launch it by selecting menu Add-Ins, TB Build Class Properties.
Download VB Code
Click here to download the VB Source Code [77k]. Updated 2002/10/17.
Previous Tip Tip Index Next Tip