Search Search

#1 worldwide
FREE Coding Lessons

since 1996
   THE BEST WAY to learn ASP & Asp.net!
Advertise Here!
click for details
Credits Host:
DiscountASP.net
Server Admin:
The "Team"
Contact Info.
Charles M. Carroll

my Blog
[prev. Lesson]  VB: Warnings/Guidelines
     [next Lesson]  VB: Installation Requirements

Generic VB Component Building Steps

Making a VB ASP component is easy:

  • Use File; New Project

  • choose Active-X DLL

  • You will now be in the editor and there will be a class open

  • when you are done, the code to invoke it on a page will look like:
    set .... = server.createobject("projectname.classname")
    choose your project plus class names well.

  • The project name and class name are set with the (name) property. They are NOT in anyway connected to the filename although you may make the filenames match the project and class names.

  • If you need to use one of the five built-in ASP objects (collectively called the scripting context) you can add a special event to your class called OnStartPage. Anytime your component is created from an ASP script, ASP will call your OnStartPage if it exists within your class. OnStartPage allows you to assign the built-in ASP objects (response, request, server, application, session) to objects in your code:

Public Function onstartpage(sc As Object)
   'Set ... = sc.response()

   'set ... = sc.server()
   'set ... = sc.Request()
   'set ... = sc.application()
   'set ... = sc.session()
End Function

  • If needed, you can add this event:

Public Function onendpage(sc As Object)
End Function

There are many worthy charities!!. But perhaps help starving children in Africa or South America AND help Charles too. a $5 tip buys him lunch at McDonalds, a $20 tip buys his kid Hitoshi a new computer game, a $39 tip buys his daughter Michiko a few nice outfits. See our donor list.