OCX Controls & software technologies

Visual Basic users' page


This page is dedicated to all the non-professional Visual Basic developers which are not very familiar with ActiveX controls and could encounter some difficulties in using our controls for the very first time. In this tutorial we will build a digital clock in 7 easy steps, using the Precision 7 Segment Digital Display, nonetheless this tutorial should be useful even for the use of the other Precision controls.

Click here to download this example (a zip file containing form1.frm and project1.vbp, 1,5 kb).

  • Step 0: Make sure that the "Digital 7 Segments Display ActiveX Control Module" is registered. To do that, follow the instructions in the FAQ section.
  • Step 1: Open Visual Basic 6.0; from the "new project" window, select the "Standard EXE" icon. A "Form 1" inside a "Project 1" will be automatically created for you.

  • Step 2: select the Form1 and select Project>Components from the menu. A dialog window will appear asking which controls you want to include in your project: select "Digital 7 Segments Display ActiveX Control Module" from the "Controls" category and click OK. The icon representing the control should now be visible on the toolbar

  • Step 3: Select this icon, the cursor will become a cross. Select a rectangular area within the form to create a new Digital 7 Segment Display control in your form. The instance of the object you just created will have name "Digital7SegmentsDisplay1".

  • Step 4: From the toolbar, select the timer object and create a timer in your form, exactly in the same way as in the previous step. The instance of the object you just created will have name "Timer1".

  • Step 5: After selecting the timer object, go to the properties window and Interval to 1000 (this means that you want to update your object every 1000 milliseconds).

  • Step 6: Now double click on the timer icon, a window will appear showing an empty "Timer1_Timer()" sub, and letting you modify its body. Simply Insert the string
        Digital7SegmentsDisplay1.DisplayedString = TIME$
        
    This means that every time the timer event fires (every second) you want to update the control's displayed string by seting it to the variable TIME$.

  • Step 7: Now double click on the form (in an empty space), a window will appear showing an empty "Form1_Load()" sub. Insert here the following line:
        Digital7SegmentsDisplay1.SetLicense( xxx )
        
    substituting the "xxx" with the license number you received after purchasing the control.

  • Finished! Simply run your program to see your new digital clock!


Copyright © 2000, by Daniele Paolo Scarpazza