My Profile
Active Members
TodayLast 7 Days
more...
Awards & Gifts
Online Exams
Fresher Jobs
Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian
cities including Bangalore, Chennai, Hyderabad, Pune or Kochi
Resources
Find educational articles, blogs, discussion threads and other resources.
Colleges
Find details about any college in India or search for courses.
Advertisements
|
Key Differences Between VB and VB Script
Posted Date: 10 May 2008 Resource Type: Articles/Knowledge Sharing Category: Computer & Technology
|
Posted By: Nikky Member Level: Gold Rating: Points: 2
|
|
|
|
Classes VBScript provides no support for classes as they are used in Visual Basic 4.0. You cannot use tags to create anything except reusable functions and subroutines. Development in VBScript is purely procedural. However, in the Internet Explorer 3.0, VBScript can automate any ActiveX component, including OLE servers (now called ActiveX components) created in Visual Basic 4.0. Control Arrays VBScript does not support control arrays. (A control array is a group of duplicate controls sharing the same name.) This is unfortunate because grouping controls into arrays always simplifies coding. You can work around this limitation, however, by having controls call a centralized routine whenever their respective events are called. For example, the following HTML code shows three buttons, each of which calls the same subroutine. Note that an index is passed with the call.
Data Access VBScript supports data access by using data access objects, as well as by using the Internet Server API (ISAPI). Data access objects (DAOs) and remote data objects (Rods) can be inserted into an HTML page and automated. Data access to any ODBC data source from an HTML page can be accomplished via ISAPI, provided with the Internet Information Server (IIS).
Debugging VBScript does not provide any debugging features. There are no breakpoints, watches, or debug windows. Additionally, the Debug object is not supported. VBScript does not allow you to "step" through code, either; however, stepping can be simulated if you use the MsgBox function periodically in your code to report information. These MsgBox functions can then be commented out or removed from the final document.
File Operations VBScript does not support any of the file operations found in Visual Basic for Applications, such as reading and writing to a file. Once again, this is because of the risks involved in being able to access the client machine without restriction. Clearly, allowing direct file I/O from the browser places the client machine at the mercy of any rogue executable that gets downloaded.
Forms VBScript provides support for forms. Forms are created with the tags. The fundamental difference between VBScript forms and Visual Basic for Applications forms is that VBScript forms are not visible as separate "windows" in the application. Instead, forms are a way to group controls together for the purpose of referencing their properties and methods in code or submitting data to a back-end process.
Help Files VBScript does not allow access to the Windows help file system. Unlike Visual Basic for Applications, VBScript also cannot produce context-sensitive help that displays topics for objects that currently have the focus. Help is once again limited to the text placed inside an HTML file. Fortunately, the hypertext links available in HTML are a convenient way to provide help. For example, the language documentation for VBScript is available on this book's companion CD as an HTML file. If you run this HTML file, you will find that the hypertext links work in a way that is similar to the way any Windows-based help file system works.
Intrinsic Constants VBScript does not support intrinsic constants, which are built-in, predefined constants. For example, to create a message box with Abort, Retry, and Ignore buttons, you would normally specify the second argument in the MsgBox statement as vbAbortRetryIgnore. However, since VBScript does not recognize intrinsic constants, you must specify the numeric values directly in code.
Menus VBScript does not support menu structures similar to those found in Windows-based applications. Windows-style menus are typically found only in the browser itself and are used to navigate the browser. You can create menu structures, however, either by utilizing HTML directly or through an ActiveX control, but such menus do not have the same appearance or interaction as true drop-down menus. In HTML, you can implement a menu structure using the anchor tag, . The anchor tag denotes a link to another URL. The anchor tag has an HREF attribute that directs the browser to a new URL when the text in the anchor is clicked. Modules VBScript supports code modules through the tag. Each script section forms an independent code module that can have its own variables, functions, and subroutines. These modules are similar to the standard BAS module found in Visual Basic. Multiple Document Interface There is no concept of a Multiple Document Interface (MDI) application in VBScript. MDI applications are programs that display multiple forms inside a large parent window. The child windows are confined to the boundaries of the parent window. Since VBScript does not present forms as independent objects, you cannot create MDI applications in a web browser.
Option Explicit As in Visual Basic for Applications, undeclared variables in VBScript are automatically dimensioned as variants. No specific requirement exists to declare variables before you use them. However, failing to declare variables can still lead to bugs in your code. Although VBScript supports only the variant data type, Option Explicit can still be valuable because it will automatically detect any typographical errors in variable names. (The Option Explicit statement requires the explicit declaration of all variables.) Therefore, we recommend the use of Option Explicit inside every set of tags. When using Option Explicit, you must remember to make it the first line of code in any script section and that the scope of Option Explicit is only inside the current tags.
System Objects Although Visual Basic for Applications supports the Screen, Printer, App, Debug, Err, and Clipboard objects, VBScript supports only the Err object. Therefore, VBScript does not allow you to access such useful objects as the mouse pointer or the clipboard. You can, however, use the Err object to provide runtime error handling for your applications.
Variables Although Visual Basic for Applications supports a myriad of different data types, VBScript supports only the variant data type. The variant is a data type that can contain any kind of variable data (integers, strings, and objects, for example). Variables are discussed in detail later in this chapter.
The Windows API VBScript does not allow web pages to make calls to the Windows application programming interface (API). Allowing such calls could jeopardize the security of the client. For example, viruses could easily use API calls to damage the client machine.
|
Responses
|
No responses found. Be the first to respond and make money from revenue sharing program.
|
|
|