Key Differences Between VB and VB Script

By Rick Darnell

You didn't run out to the computer store and buy a copy of VBScript. You didn't install a VBScript disk on your computer, either. All you did was install the Internet Explorer browser, which supports VBScript, on your computer--just like millions of other folks. Everyone of them has the VBScript engine on their computer, and everyone of them has the ability to create Web pages with VBScript.

So where's the integrated development environment that you're used to using in Visual Basic? Keep looking, because there isn't one. All you have is your favorite text editor, the ActiveX Control Pad, and a Web browser. That in itself is the single largest difference between Visual Basic and VBScript. It leads to some specific differences, too. Here's what they are:

  • Debugging  VBScript doesn't have a debugger like Visual Basic. You'll resort to using lots of message boxes, instead.

  • Event-handlers  You don't have an editor in which you select an object and event to edit an event-procedure. You have to name event-procedures in your scripts so that the scripting engine can find the appropriate handler when an object fires an event.

  • Forms  VBScript doesn't have a forms editor. It doesn't need one, because you can't display forms anyway. You put forms and controls on the Web page, instead. You can use the ActiveX Control pad to insert all those nasty <OBJECT> tags in your Web page, however.

You don't compile a VBScript program into an EXE file like you do with a Visual Basic program. You distribute your scripts as plain, old text embedded in HTML files. Everyone and his uncle can read your scripts. The script engine interprets this text into intermediate code when it loads the Web page. It also creates a symbol table so that it can quickly look up things such as event-procedures and variable names. The scripting engine uses the ActiveX Scripting technology to interact with the browser.


[BEG]NOTE:[END] You'll find a plethora of nit-picky differences between Visual Basic and VBScript, too. You have to use the value property to query an objects value, for example. Thus, instead of reading a text box's value using form.text, you have to read it using form.text.value. These subtle differences are too numerous to document in this appendix. Go to Microsoft's Web site (www.microsoft.com) and their knowledge base for further explanation of these differences.

Another significant difference between Visual Basic and VBScript is the keywords that Microsoft omitted from VBScript. You'll learn more about the keywords included in VBScript in the next section. You'll learn about the keywords that Microsoft omitted from VBScript in "Visual Basic Keywords Omitted from VBScript," later in this appendix.

from Special Edition Using HTML 4:
VB Script Keyword Reference

by Rick Darnell

© Copyright Macmillan Computer Publishing. All rights reserved.

Make a Comment

Loading Comments...

  • Web Development Newsletter Signup

    Invalid email
    You have successfuly registered to our newsletter.
  •  
  •  
  •