ActiveX Guide

VB Control Creation


An easy introduction, for this we have described how to create a simple clock control all it does is diplay the time. We won't go into signing it just yet, but the .html code that gets created will "download" the .cab file that the .ocx that you create will be packaged into.

For this you will need the Visual Basic 5 Control Creation Edition.

Sorry if the visuals are a little dodgy.

  • Load the Control Creation Edition.

  • Then, create an "ActiveX Control" Project.

  • Add a LABEL control and a TIMER control to the Form, then change the "User Control" name to something like "Test" or "Test Project".

  • Make the LABEL a little larger, center the text (change the "Text Justify" property to centered) and choose a larger font.

  • Move the TIMER into the top left hand corner of the form, change the Interval property of the TIMER so it equals 1000 (1 second).

  • Double click on the TIMER so the code window appears, add the following into the code.

    Label1.Caption = time

  • Leave the code view and move the LABEL into the top left hand corner of the Form and then adjust the size of the Form so that is is the same size as the LABEL.

  • Alter the properties of the LABEL so that the "Background Color" property equals "transparent" and then the properties of the Form so that the "Background Color" property also equals transparent.

  • Go into the project properties and from the "General" page, change the "Project Name" to "Clock" and the "Project Description" to whatever you want.

  • Next, select the "Make" page and check the "Auto Increment" box, then move onto the Component page and make sure the "Project Compatability" radio button is selected.

  • Save everything.

  • Create the .ocx

    Now you have your simple Clock ActiveX control, the next thing to do is to create a download set.