Visual Basic Concepts

Step Three: Set the Webclass's First Actions

You must tell the webclass which page (or template webitem) to display when the application is first run. You do this by writing code for the Start event. In this case, the first page you want to display is the Menu page. You will use the Start event to pass processing to the Menu template webitem's Respond event. The Respond event writes the template to the browser and displays it.

To set the Start event

  1. In the left panel of the webclass designer, double-click on the Support webclass. The code window appears and displays the Start event procedure.

  2. In the Private Sub WebClass_Start() procedure, delete all the sample code inserted by the designer and add the following code:

    Set NextItem = Menu
    

To set the Respond event for the Menu page

  1. In the Code Editor window, access the Menu_Respond event.

  2. In the Private Sub Menu_Respond() procedure, add the following code:

    Menu.WriteTemplate
    
  3. Close the code window and save your project.

At this point, you should be able to run your project and view the Menu page in your browser. The buttons are not yet functional, but the page should appear.

To test the project

  1. Press F5, then click OK in the Project Properties dialog box.

  2. A prompt appears telling you that a virtual root directory will be created for your project. This is necessary for the IIS process to run correctly. Change the name if you want to, or click OK to accept the default. You should see the following page: