Hello World Visual Basic Class Modules

Hello World for Windows® DNA contains two class modules. The first, CHelloWorld.cls, is declared as a public class and called from the default.asp page of the Hello World application. The second class, CHelloData.cls, is declared as a private class and is called from CHelloWorld. The CHelloWorld module uses CHelloData to call an ActiveX Data Objects (ADO) object to retrieve "Hello World" from the database in the client browser's default language. CHelloData returns the phrase to CHelloWorld, and CHelloWorld uses the ASP Response object to return the string "VISUAL BASIC COMPONENT SAYS: Hello World" to the ASP page, which in turn sends it to the browser as HTML.

Note  To compile these classes into a DLL, you need first to create a new Visual Basic project as an ActiveX DLL. Add each module to the project by clicking Add Class Module on the Project menu. Then, click References on the Project menu to add the following references to the project: Microsoft Active Server Pages Library, Microsoft Transaction Server Type Library, and Microsoft ActiveX Data Objects 2.0 Library. Finally, you can compile the DLL from the File menu.

In the next two topics, you will see how the code in two classes, CHelloWorld and CHelloData (both written in Visual Basic), executes. There is a link that will take you from the topic Hello World Public Class CHelloWorld into the topic Hello World Private Class CHelloData at the exact point where the code in CHelloWorld calls into CHelloData. There is then a link at the end of the topic that returns you from the discussion of CHelloData to the subtopic Code Executed After HelloData Returns. This topic describes the code that executes after CHelloData has passed the result of its work to CHelloWorld.