Share via


Visual Basic Concepts

Testing Your DHTML Application

When you debug a DHTML application, you have the full Visual Basic development environment at your disposal. You can use all the tools available in Visual Basic — breakpoints, watch variables, debug statements, and so on — to debug your project.

Note   A file named VB6DEBUG.DLL enables you to debug your DHTML application across processes. Do not delete this file or you will not be able to test your application.

The settings in the Debugging tab of the Project Properties dialog box determine whether the system waits for you to tell it what to do when you go into run mode or automatically starts a page designer you specify, displaying its page in the browser. You can also indicate whether to open a new instance of Internet Explorer or use an existing instance.

When Visual Basic runs the application, it inserts a METADATA tag and an OBJECT tag into the body of each HTML page used in your application. The OBJECT tag is used to download the HTML page when the application is deployed. It includes two parts — a classID for your application, and a CODEBASE attribute that tells the browser where to find your application's .cab file. Visual Basic temporarily fills in the CODEBASE attribute during debugging so that your project can run; this value is removed once debugging stops. The final value of the CODEBASE attribute is filled in when you package the application for deployment using the Package and Deployment Wizard.

A sample OBJECT tag is shown below:

<BODY>
   <!--METADATA TYPE="MsHtmlPageDesigner" startspan-->
   <OBJECT codebase=DHTMLProject.CAB#Version1,0,0,0 id="DHTMLPage1"
   classid="clsid:C01F6165-E8DB-11D1-AA99-00C04FA34731" width=0 height=0>
   </object>
   <!--METADATA TYPE="MsHtmlPageDesigner" endspan-->

DHTML Debugging Tips

Be aware of the following things as you debug and test your DHTML applications:

  • In the Locals window, functions used in your DHTML application are listed twice. This may cause difficulty because it allows you to seemingly set two different values for Booleans.

  • Several properties listed in the Locals window will produce an error if you try to edit their value. These include the following properties:

    DHTMLPage.BaseWindow.document.activeElement.all.length
    DHTMLPage.BaseWindow.document.activeElement.offsetParent.all.length
    DHTMLPage.BaseWindow.document.activeElement.children.length
    
  • If you refresh Internet Explorer while your DHTML project is in break mode, then you return to run mode in Visual Basic, your breakpoints will no longer be hit and stop instructions will no longer be followed. Stop debug mode, then press F5 again to begin your debug process a second time.

  • If you add a message box to your DHTML page, the message box appears behind Internet Explorer when you debug. In addition, you cannot move Internet Explorer out of the way in order to view the message, because the message is modal. When you hear the beep that indicates a message is on the screen, select the Visual Basic application from your taskbar to view and clear the message.

  • You should avoid watching objects of type HTMLDocument.

For More Information   See "Debugging Your Code and Handling Errors" in the Programmer’s Guide for more information on how to test and debug your applications.