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
- Create new ActiveX control project using File.New Project and choose ActiveX Control at the type
- Add label control to the UserControl (ActiveX control) you have just created
- Set properties on the label control
Set label control Name property to "lblSource"
Set label control Caption property to "[No Sound Source]"
- Name the project and control
Project name = web
Control name = bgsound
- 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
- Use Add-Ins.ActiveX Control Interface Wizard to launch wizard
- Remove default events, props, and methods that have been added
- Add the following properties
(Note: Repeat is used instead of Loop because Loop is a Visual Basic keyword)
Source
Repeat
- Point Source property to lblSource.Caption property
- Set datatype of Repeat to integer and default to -1
- Finish wizard
Add Web design-time control support
Step 3: Add IActiveDesigner interface reference to project
- 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
- Add IProvideRuntimeText interface definition
Implements IProvideRuntimeText
- 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
- Compile web.ocx
© 1997 Microsoft Corporation. All rights reserved. Legal Notices.