Partager via


Visual Basic Concepts

Beginning Your DHTML Application Project

When you begin a DHTML application, you select a special type of project called a DHTML Application project. A DHTML Application project is an ActiveX DLL project that automatically sets the correct references you need to access the designer for your HTML pages and the appropriate toolbox tab and controls.

Visual Basic automatically inserts a designer into the project and displays it on the screen when you open this project type. The designer corresponds to a single HTML page and acts as the base on which you create its user interface. If you want to include more than one HTML page in your application, you can insert additional designers into your project.

The application you create runs as an in-process component in the Web browser or Web browser control. For more information on in-process components, see the "In-Process and Out-of-Process Components" section in the Component Tools Guide.

To begin your DHTML application

  1. Start a new project and select DHTML Application as your project type.

  2. In the Project Explorer window, open the Designers folder, then double-click on DHTMLPage1 to display it in the main window.

To add additional DHTML pages to your project

  1. On the Project menu, click Add DHTML Page and Visual Basic adds a new page designer to your project.

    Note   The first four kinds of ActiveX designers loaded for a project are listed on the Project menu. If more than four designers are loaded, the later ones will be available from the More ActiveX Designers submenu on the Project menu.

  2. In the DHTMLPage Properties dialog box, choose how you want to save your HTML pages, then click OK.

Save Options for Pages and Designers

When you add pages to the project, you must make decisions about how your page will be saved and whether you will create a new page or edit an existing HTML page from your hard drive. There are two ways you can save your page:

  • Save it within the designer file. This method allows you to easily share files between developers or move your development project from machine to machine without worrying about paths to any external pages. However, saving your page in this way prevents you from using the Launch Editor feature to edit it in an external HTML or text editor.

  • Save the page to a location on your computer. This method creates external HTML files that are referenced in the designer's SourceFile property by an absolute path. When you save to an external file, you can use the Launch Editor feature to edit the page in an external HTML or text editor. However, moving your file from machine to machine may cause the path you entered for your source file to become invalid.

The SourceFile property for the designer reflects the save method you choose. When you save within the designer, the SourceFile property is blank. When you specify an external file, the SourceFile property reflects the full path to the file you selected.

The save options you choose apply only until the project is built. At that time, the system generates external HTML files for the pages in your project and stores them in the location you specify.

Specifying save options for a page

To access the DHTMLPage Properties dialog box

  • Select the page designer and then click the Properties toolbar icon.

To save your HTML page within the designer files until the project is built

  • Click Save HTML as part of the VB project in the****.DHTMLPage Properties dialog box.

To create a new page and save it to a location on your computer

  1. Click Save HTML in an external file in the****.DHTMLPage Properties dialog box.

  2. Click New, enter a file name for your page, and click OK.

To import an existing page and save it to a location on your computer

  1. Click Save HTML in an external file in the****.DHTMLPage Properties dialog box.

  2. Click Open, choose the file you want to edit, and click OK.

To import an existing page but save it within the designer

  1. Click Save HTML in an external file in the****.DHTMLPage Properties dialog box.

  2. Click New, choose the file you want to import, and click OK.

  3. Click Apply to import the page.

  4. Click Save HTML as part of the VB project.

  5. Click OK to return to the page designer.

    Visual Basic sets the value of the SourceFile property to reflect the choices you made.

Note   You can edit the SourceFile property directly to make the same choices. Enter a path and file name in the Properties window to import a file or save to an external file, or clear the contents of the SourceFile property to save the page within the designer.