Computer Science II
Computer Science II
Computer Science II
College Of Pharmacy
)(Visual Basic
Objective:
Compilation:
No matter what the version, in order to run a VB program, the VB runtime module
must reside in the target computer. This .DLL file, named VBRUNxxx (up to VB
4) or MSVBVMxx (VB 5 and 6), where x is the version number, contains
necessary runtime libraries and also converts programs compiled to bytecode into
the machine language of the computer. The runtime DLLs are widely available and
typically accompany a Visual Basic application. See VB.NET and VBScript.
Characteristics:
Instead of being identified by line number alone, code may be grouped into
named subroutines or methods: Sub...End Sub. Visual Basic supports user-
added line numbers through version 6, or later.
Code Statements have no terminating character other than a line ending
(carriage return/line feed). Versions since at least VB 3.0 allowed that
statements can be implicitly multi-line with concatenation of strings or
explicitly using the underscore character (_) at the end of lines.
Code comments are done with a single apostrophe (') character. ' This is a
comment
Looping statement blocks begin and end with keywords: Do...Loop,
While...End While, For...Next .
Multiple variable assignment is not possible. A = B = C does not imply that
the values of A, B and C are equal. The Boolean result of "Is B = C?" is
stored in A. The result stored in A would therefore be either false or true.
Boolean constant True has numeric value −1. This is because the Boolean
data type is stored as a two's complement signed integer.
Logical and bitwise operators are unified. This is unlike some C-derived
languages (such as Perl), which have separate logical and bitwise operators.
This again is a traditional feature of BASIC.
Variable array base. Arrays are declared by specifying the upper and lower
bounds in a way similar to Pascal and Fortran.
Relatively strong integration with the Windows operating system and
the Component Object Model. The native types for strings and arrays are the
dedicated COM types, BSTR and SAFEARRAY.
Banker's rounding as the default behavior when converting real numbers to
integers with the Round function.
Integers are automatically promoted to reals in expressions that involve the
normal division operator ( / ) so that division of one integer by another
produces the intuitively correct result. VB provides a specific integer divide
operator ( \ ) that does truncate.
By default, if a variable has not been declared or if no type declaration
character is specified, the variable is of type Variant
Applications:
References:
1. www.wiki.org
2. www.investopedia.com
3. www.pcmag.com