What is the difference between VB and VBScript

2019-01-23 01:01发布

What is the difference between VB and VBScript?

6条回答
Juvenile、少年°
2楼-- · 2019-01-23 01:49

This is a very old question, but existing answers are outrageously vague, and/or fail to identify the most important stuff, when they're not just plain wrong. Not going to repeat what other answers already indicate, but the following differences are missing from the other answers:


Scopes

VBScript code doesn't need procedure scopes: it can be written as a [drumroll] script that just executes a bunch of procedural operations top-to-bottom.

In VB6/VBA executable statements can only exist inside procedure scopes.


Types

In VBScript everything (variables, function return values, etc.) is a Variant (i.e. pretty much a duck, like in JavaScript). It is illegal to declare an explicit type when declaring a variable. The As keyword is illegal!

In VB6/VBA everything defaults to an implicit Variant, but good VB6/VBA code uses explicit types where applicable.

查看更多
女痞
3楼-- · 2019-01-23 01:52

VB is a full-fledged programming language which can be used to create compiled applications, while VBScript is a sub-set of VB and is a scripting language that can be used to run a set of commands, similar to an old-school DOS batch file. Generally, a scripting language can not be used to create a full-fledged binary application and it can not be compiled down to a executable binary file.

查看更多
戒情不戒烟
4楼-- · 2019-01-23 01:57

VB is application development tool (like, desktops, web based application)

And VB script is scripting language, it can not independently developed application.

查看更多
姐就是有狂的资本
5楼-- · 2019-01-23 02:00

Also VBScript's code can be ran in VB6. Maybe that confuses you.
But all VB6's codes can't be ran in VBScript.

查看更多
趁早两清
6楼-- · 2019-01-23 02:05

VBScript is a variety of VB, just as VB6, VBA, and VB.NET are. They're all different, some of them dramatically so.

查看更多
老娘就宠你
7楼-- · 2019-01-23 02:06

VBScript is a "lightweight" subset of Visual Basic with limited syntax that is used for scripting purposes (like routine task automation) rather than application development.

While Visual Basic code is compiled into binary executables, VBScript code is interpreted and runs within a host environment (e.g. Windows Script Host or Internet Explorer).

查看更多
登录 后发表回答