Registering a Visual Basic Control for Testing

Before testing your control, you need to register it as design-time control. Building the control in Visual Basic doesn’t register your control automatically nor does it specify that it is a design-time control. Without proper registration, your control can be difficult to add to the Visual InterDev toolbox for testing.

You need to register the control as you would any other control, plus you need to update the special component category entry in the registration database. The program regsvr32 registers the control and the tool, regsvrdc.exe, provided in the Tools directory of the SDK updates the control's category.

You might be tempted to have your users complete these steps when you deploy your control. However, you can provide your users with an easier deployment procedure. For more information about registering your control during deployment, see Distributing a DTC.

Note   Visual Basic changes the control's CLSID each time you build the control. However, the control's ProgID changes only when you change the project name or control name in your Visual Basic project.

To register a Visual Basic control

  1. At a command prompt, navigate to the directory for the control.

    For example, to register the sample of a Visual Basic design-time control provided with this SDK, you can navigate to c:\program files\dtcsdk60\samples\bin\.

  2. Run Regsvr32.exe and specify the name of the control you want to register.
    regsvr32 vbsample.ocx
    

    A message confirms that the registration succeeded.

  3. For each DTC in the ocx, run Regsvrdc to register the control's component category as a DTC.

    For the sample, you can enter the following:

    Regsvrdc vbsample.SourceDTC
    Regsvrdc vbsample.SinkDTC
    Regsvrdc vbsample.QueryBuilderDTC
    Regsvrdc vbsample.ObjectModelDTC
    

After registering the controls, you can test them. For more information, see Testing a DTC's Output.