Step-by-Step: Building a Web Design-time Control with Visual Basic

October 6, 1996

Contents

Create an ActiveX control
   Step 1: Create ActiveX control project
   Step 2: Use Visual Basic ActiveX Control Interface Wizard to configure your control
Add Web design-time control support
   Step 3: Add IActiveDesigner interface reference to project
   Step 4: Implement IActiveDesigner interface

Summary

This document is a step-by-step tutorial for creating the BGSound Web design-time control using Visual Basic® Control Creation Edition version 5.0.

Create an ActiveX control

Step 1: Create ActiveX control project

  1. Create new ActiveX control project using File.New Project and choose ActiveX Control at the type
  2. Add label control to the UserControl (ActiveX control) you have just created
  3. Set properties on the label control

    Set label control Name property to "lblSource"
    Set label control Caption property to "[No Sound Source]"

  4. Name the project and control
    Project name = web
    Control name = bgsound
  5. Save project and name project file as web.vbp; control file as bgsound.ctl

Step 2: Use Visual Basic ActiveX Control Interface Wizard to configure your control

  1. Use Add-Ins.ActiveX Control Interface Wizard to launch wizard
  2. Remove default events, props, and methods that have been added
  3. Add the following properties
    (Note: Repeat is used instead of Loop because Loop is a Visual Basic keyword)
    Source
    Repeat
    
  4. Point Source property to lblSource.Caption property
  5. Set datatype of Repeat to integer and default to -1
  6. Finish wizard

Add Web design-time control support

Step 3: Add IActiveDesigner interface reference to project

  1. Add reference to "Microsoft Web Design-time Control Type Library"
    Use Project.References and scan the list of available references to ensure that it is checked if present. If not, then browse to the c:\progra~1\dcsdk\samples\vb\common directory (if you used the default install location) and add webdc.tlb as a project type reference. This will automatically check it and include it in your project.

Step 4: Implement IActiveDesigner interface

  1. Add IProvideRuntimeText interface definition
    Implements IProvideRuntimeText
    
  2. Implement IProvideRuntimeText_GetRuntimeText
    Dim strText As String
    Dim strQuote As String
    strQuote = Chr$(34)
    strText = "<BGSOUND SRC=" & strQuote & lblSource.Caption & strQuote 
    strText = strText & " LOOP=" & strQuote & Repeat & strQuote &  ">"
    IProvideRuntimeText_GetRuntimeText = strText
    
  3. Compile web.ocx
© 1997 Microsoft Corporation. All rights reserved. Legal Notices.