Visual Basic Concepts

Creating the Support Webclass

The series of step-by-step procedures in this section builds a simple webclass application called Support. Although the application itself is not complex, building it will quickly demonstrate the major techniques involved in creating a functional webclass. Through this tutorial you will learn how to do the following:

  • Add templates and custom webitems to a webclass

  • Use your Web application to manipulate databases with ADO code

  • Generate HTML dynamically in response to user actions

  • Populate a predefined HTML template at run time

  • Generate and process new events at run time

The Support application contains a Menu page and two similar pages that display data: one showing all customers of a fictional company, and another showing all calls made by those customers. In addition, a second set of pages shows detail about the currently selected customer or call.

This tutorial covers how to build the Menu page, the Customers page, and the page that gives customer details for the selected customer. You can then use the skills you've learned to build the Calls page and its associated Detail page, or you can download the full sample from the Web.

All of the subjects introduced in this tutorial are covered in greater depth in the section "Developing IIS Applications with Webclasses," in the Building Internet Applications section of the Component Tools Guide. The procedures for developing the Support application build on one another, so it is important to perform them in order.

Important   To run this application, you need a copy of the contact.mdb database. You can create it yourself in Microsoft Access by clicking File \ New Database and selecting the Contact Management database template, or you can download it from the MSDN Web site. If you generate it yourself, be sure to populate it with sample data and save it as contact.mdb.

Topics

Step One: Create the Support Project

Opens a blank IIS application project and sets required properties.

Step Two: Add the Menu Template

Adds an HTML template to the project to act as the main navigational page for the application.

Step Three: Set the Webclass's First Actions

Shows how to use the Start event and the NextItem method to determine what the webclass does when it is first launched.

Step Four: Add a Custom WebItem

Adds a custom webitem that the webclass will use to process user-generated events.

Step Five: Connect the HTML Form Elements

Shows how to make HTML elements programmable, so that their events can be intercepted and processed. 

Step Six: Write Code to Retrieve and Display Customer Ids

Uses ADO code to intercept a user event from the browser, open a database connection, retrieve records, and write a new HTML page to the browser.

Step Seven: Add Navigation Using the URLFor Method

Creates links from the generated HTML page back to the webclass.

Step Eight: Create the Detail.htm Page

Adds a new template to the webclass that will display details about the selected record.

Step Nine: Write Code for Generated Events

Shows how to use the UserEvent procedure to determine which row in a table was selected and return the appropriate recordset. 

Step Ten: Populate the Detail Page

Shows how to process replacement tags in a template and populate it with the appropriate data.

Step Eleven: Test your Application

Performs a final check on your project.