[ Go to March 1997 Table of Contents ]

WinLab Reviews
Visual Basic 5 Control Creation Edition
ActiveX Made Free and Easy

-- by James E. Powell

Until now, creating an ActiveX control has been best left to C++ programmers. But to make OCX-dependent Active Desktop more popular, Microsoft has developed Visual Basic 5.0 Control Creation Edition (VB5CCE)-and is giving it away. For the first time you can create custom controls with the familiar Visual Basic programming environment and language syntax, which, at last count, is used by more than four million developers.

The controls you build are backward compatible with ActiveX control host environments, including all the Office 97 applications. Although the beta I tried had a few bugs, the program is remarkably robust. Its user interface gives you a peek into the full VB5 development environment, due in a month or two. While the program will compile your custom control, it doesn't let you build the traditional VB application, and there is no online context-sensitive help.

Though I'm familiar with VB, and have used dozens of commercial controls, I never created my own. Using the standard controls from within the VB5CCE environment, I built a simple OCX. I included a button that, when clicked, would concatenate first and last name fields and display the result in the third field. I named the control "FullName" and saved my work, then switched to the development environment (the test host mode), which automatically included my control in the toolbox. There I added the FullName control to the blank form, added several standard controls, wrote some code and tested my work-all without leaving VB5CCE.

A simple wizard helped me set up new methods and properties and wrote skeleton code; I used the new methods and properties in my sample application as easily as with a commercial OCX.

Creating a control from scratch isn't your only option. You can customize an existing control. For instance, you can take an existing frame control and create a control that includes your logo in the bottom right-hand corner. Furthermore, you can compile multiple ActiveX controls into a single control. If you have design-time rights, you can subclass a commercial control, such as a calendar control, to add your own logic or override existing methods.

You can take ActiveX control development further by adding your own property page. I created several properties, then used a wizard to create a custom property page. VB5CCE wrote the code for me. When I switched to test host mode, the standard property page for FullName added a Custom property; clicking on it displayed my new property page. Alternatively, you can right-click on your control and select Properties.

As expected, there are dozens of advanced options. Controls can be made data-aware so they can be linked to a database. Your control's behavior can be customized according to whether you are in design or run mode. You can add events, a feature I did not test. Creating an invisible control at run time (like VB's timer control) is no sweat, and you can use transparent backgrounds so controls look non-rectangular.

VB5CCE's Setup Wizard will compress files, create a cabinet (CAB) file and produce a sample HTML page that triggers the automatic download of your control when used on the Web.

Debugging is slick: From the test host mode you can press F8 to enter debug mode, then trace through your code line by line, automatically jumping from your application code to the custom control code and back again. This is especially helpful for tracing through methods. My 14KB sample control was generated in less than 4 seconds on a Compaq Deskpro Pentium 166 with 32MB of RAM.

VB5CCE can keep multiple projects open at the same time. It also lets you drag-and-drop code within and across code windows. The enhanced Project window lets you navigate through project components (forms, controls, classes, modules and resource files), and the tabbed Properties windows let you switch between a list arranged alphabetically or by category.

There is still considerable room for improvement in the development environment. I'd like the option to have an If/Then/Else code template entered when I type "If." VB5CCE is devoid of significant documentation, so it may be tough to begin and understand the "let" and "get" codes. The setup program for adding my tiny control spans two diskettes, which is ridiculously large. Many of the keyboard shortcuts are not intuitive.

Since Microsoft has put VB5CCE on the Internet, it won't be available in retail stores. The company will include CCE functionality as part of VB5 (Standard, Professional and Enterprise editions). On behalf of Visual Basic programmers everywhere, thank you, Microsoft, for making it incredibly easy to create ActiveX controls.

W Info File

Visual Basic 5 Control Creation Edition
Price: Free download
Pros: Everything you need is here; good user interface improvements
Cons: Skimpy documentation; large setup files needed to install your controls
Platforms: 95, NT
Microsoft Corp.
800-426-9400, 206-882-8080
Circle #606 or visit Winfo Online
WinMag Box Score: 3.5

Copyright (c) 1997 CMP Media Inc.

Windows Magazine, March 1997, page 128.

[ Go to March 1997 Table of Contents ]