Click to return to the Component Development home page    
Web Workshop  |  Component Development

Visual Basic Step-by-Step


Jay Massena and Douglas Hodges

Updated: February 12, 1997

Summary

This document is a step-by-step tutorial for creating the Bgsound design-time control using Microsoft® Visual Basic® version 5.0.

Contents
Step 1: Create ActiveX Control project
Step 2: Use the VB ActiveX Control Interface Wizard to configure your control
Step 3: Add IActiveDesigner interface reference to project
Step 4: Implement IActiveDesigner interface



Create an ActiveX Control

Step 1: Create ActiveX Control Project

A. Create new ActiveX control project using File.New Project and choose ActiveX Control at the type.

B. Add label control to the UserControl (ActiveX control) you just created.

C. Set properties on the label control.

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

D. Name the project and control.

Project name = web
Control name = bgsound

E. Save the project and name the project file "web.vbp"; name the control file "bgsound.ctl."

TopBack to top

Step 2: Use the VB ActiveX Control Interface Wizard to Configure Your Control

A. Use the Add-Ins.ActiveX Control Interface Wizard to launch the wizard.

B. Remove default events, props, and methods that have been added.

C. Add the following properties. (Note: Repeat is used instead of Loop because Loop is a VB keyword)

Source
Repeat

D. Point the Source property to lblSource.Caption property.

E. Set the Repeat datatype to integer and the default to -1.

F. Finish wizard.

TopBack to top

Add Design-time Control Support

Step 3: Add IActiveDesigner Interface Reference to Project

A. Add reference to the "Microsoft Web Design-time Control Type Library."

Open Project.References and scan the list of available references making sure that the Microsoft Web Design-time Control Type Library is checked if present. If the library is not listed, then browse to the c:\program files\design-time control sdk\samples\vb\common directory (if you used the default install location) and add webdc.tlb as a project type reference. This automatically checks the library in Project.References and includes it in your project.

TopBack to top

Step 4: Implement IActiveDesigner Interface

A. Add IProvideRuntimeText interface definition

Implements IProvideRuntimeText

B. 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

C. Compile web.ocx



Back to topBack to top

Did you find this material useful? Gripes? Compliments? Suggestions for other articles? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.