Programming in Visual Basic language

The most important commands from Visual Basic programming language in one place, a unique comparison and each command-operator is shown using a piece of program. Statements-operators of these sample programs are clickable, so with a simple click we have more information available.

Programming language Visual Basic:


Lexical elements

Lexical elements are numeric, string constants and comments in the code.

Types and variables

Types and variables are closely related because variables are the most important elements of our program in which we store data, partial results of our calculations. Types tell us what data can be stored in variables.

Program structure


Operators

Operators perform an operation between the operands, this operation can be mathematical, logical, or bitwise.
Parenthesis operator: ( )

Statements

Statements are important elements for writing programs. Generally one statement line corresponds to one line program. The main group of the statements are: cycles, program branching and flow control.

Visual Basic .NET

 i = x * 5
 while i>0
   if i=10 then
     exit do
   else
     i=i-1
   end if
end while

Examples - Visual Basic

Visual Basic .NET

xmin = -2147483648
 ymax = 2147483647
Dim x As integer= -12345          ' x = -12345
Dim y As integer= -(15123 \ 70)' y = -216
z = CInt((x * y))       ' y = 2666520

Visual Basic .NET

x = 10 * 5      ' x=50
y = 100 * 1.2   ' y=120
z = (x / 5) * 10' z=100

Visual Basic .NET

Other pieces of example codes:
do until i = 0
   if i=10 then
     exit do
   else
     i=i-1
   end if
loop
if i=16 then
    continue while
 end if
Dim x As integer= -12345
b = x <= 12
y =CSng((x * y))
(x * y)
Languages: en hu cz sk