Home

Visual Basic.Net

 

VB.NET is a programming language aka software development tool.  Programming languages are used to create operating systems, applications programs such a Word, Excel, Access, PowerPoint, FrontPage, Publisher, and Telecommunications programs.  Everything that we do with a computer must first be written in a programming language.

The first programming language developed is called machine language which is written with 1 and 0.  This language is often referred to a binary or digital language.  This language required the programmer to give step by step instructions for each action in binary code. Computers only understand machine language.

The second level programming language is called assembler language.  This language allowed the programmer to use alphabet characters such as MV (which means move) that will be translated by the program into machine language. Two methods are used to translated a programming language into machine language.  
    1. A compiler takes all of the source code and translates the code into another file called the object file which is in binary format and then executes the object file.  The source file still remains. Compiled programs execute independent of the programming language and execute much faster than interpreted languages. Object files generally have a .exe extent. When you compile code in vb.net it is first complied in an intermediate language (IL) and then executed Just in Time (JIT) by the Common Language Runtime (CLR) compiler which is distributed with the IL code when sent to a PC or an Internet Site.
    2. An interpreter take one line of the source code translates it into machine code, executes the line, returns to the source code and gets the next line, interprets it into machine code.  This continues until all of the source code has been translated and executed line by line from the top of the program to the bottom.  This is referred to as sequencing through the program. An interpreter functions inside of the programming language. 

The third level programming languages (Higher Level) consisted of languages that were closer to natural languages.  Cobol, RPGII, Qbasic, Pascal, C, C+++, Fortran are examples of third level languages.   These languages allow you to use English words such as print, input, and read to write  program code.  

The fourth level languages are the visual languages such as Visual Basic, VB.NET and Visual C+++.  These are also called Object Oriented Programming languages because they attached code to objects (icons/visual pictures).  Windows 98 was written using OOP. 

The fifth level languages are the voice actuated languages.  Windows Office XP comes bundled with voice actuation and writing pad actuation. 

Visual Basic.NET a Object-Oriented programming Language AKA as OOP.

Visual Basic .NET combines a graphical interface called the Integrated Development Environment (IDE) and programming code to make program development as rapid as possible. The IDE contains tools for creating, testing and running computer programs.

The core of the .net environment is the IDE known as Visual Studio.Net (VSN).  VSN includes visual basic.net among several other programming languages such as C#.net  and C+++.net. Microsoft also sells the IDE to third party vendors who use it for their own programming languages.  There are three way of writing code in the IDE.

1. Console mode applications in which the code is run from the XP command Prompt.  This is the same mode as earlier versions of Basic, BasicA, and Qbasic.  There is no graphic user interface.

2. Windows-based mode applications in which code is written and run in windows graphic interface on the desktop.  When writing code in the window mode objects are created which are event (action) driven and execute code attached to the graphic object.(OOP).  The user interface in the windows mode is a form in which objects are placed and code attached in the background.

3. Web-based mode applications has a web user interface and runs on a web server that can be accessed using a computers internet browser.

Code can be written to execute in the Command Prompt environment, Windows environment, and Web Server environment using the IDE.

We will only be working with the windows-based application environment in CIS 1.

An object is anything that can bee seen, touched, or used;  When ever you go to the start button in window you are going to an object.

Attributes are the characteristics that describe the object. When you tell someone that you have a Pentium 4 computer that runs at 4 GigaHz, a DVD drive and 1 GigByte of Memory you are describing some of the attributes of your computer.

An objects behaviors also referred to as methods are the operations (actions) that the object is capable of performing.  Your computer can save digital files to a hard drive, transmit and received data over the internet, be used for word processing, etc.

A class is a structure, design  used to build an object and includes (encapsulates) the attributes and behaviors of the object. Your computer would be a class that has the above attributes and behaviors. A class is not an object until it has been built. Your computer did not become an object until an instances (the building of the computer, the use of the class in the program) of the class occurs.

Abstraction refers to the hiding of the internal detail of an object from the user.  This prevents the user from changing the object when they should not be messing with it. Attributes that are not hidden are said to be exposed to the user.  You only want to expose the behaviors and attributes that are necessary for the user to complete their job and hide all of the rest of them.

Once you create a class you can create another class from it called a derived class.  The derived class inherits(inheritance)  the attributes and behavior from the base class ( the class from which it was built). When you buy a new computer the salesman will show a base machine, and then will show you one with a DVD, Joy Stick, Large Monitor, Wireless Keyboard, etc.  The computer with all the bells and whistles is derived from the base class and inherits all of its attributes and behaviors and has some of its own.

Polymorphism is the oop feature that allows the same instruction to be carried out differently depending on the object. You open a file, open a form, open a report, etc.

An event (action) is something that occurs to an object.  When you left click the start button (object) on the window desktop  a pop up window comes up that allows you to access the programs.  The left click was an event that executed code that was attached to the object. If you right click the start button the response will be a different pop up menu.  The right click action executes different code on the object.  One object can have many different events associated with it. Visual Basic. Net is an event driven OOP language.

Visual Basic .Net is a graphical programming language that let you build a complete application without writing any source code.  The functionality of the application will be very limited without writing code.

Writing Source code attached to objects.

All computer languages operate within the Structured Theorem parameters which allow the solving of programming problems with:

    1. Sequencing in which source code is executed line by line from top to bottom.  All computers execute source code starting at the top of the program and continue to the bottom (end) of the program code.

    2. Selection in which a branch of code is executed based on a true or false condition. The control structures used with selection are if, then, endif for single selection, if, then, else, endif for two way selection statement, and a if, then, elseif, then, else enidif for multiple selection. 

IF condition1 THEN
[statementblock-1]
[ELSEIF condition2 THEN
[statementblock-2]]...
[ELSE
[statementblock-n]]
END IF
If age < 30 then
Print "You are less than 30 yrs old"
ElseIf age <40 then
print "You are less than 40 yrs old"
Else
Print "You are older than 40"
End If

 

    3. Iteration (looping, repetition) in which a branch of code is executed over and over while a condition is true.  The control structures are Do While-Loop,- Do Loop Until, and For, Next  for iteration statements.

DO [{WHILE | UNTIL} condition]
[statementblock]
LOOP
or
DO
[statementblock]
LOOP [{WHILE | UNTIL} condition]

FOR counter = start TO end [STEP increment]
[statementblock]
NEXT [counter [,counter]...]

    4. Select Case allows selection of a branch of code based on a pre-selected condition being true. My friend Brian Marshall considers that the Select Case is a selection statement and that Structured Theorem only has three elements. The control structure for select case is

SELECT CASE testexpression
CASE expressionlist1
[statementblock-1]
[CASE expressionlist2
[statementblock-2]]...
[CASE ELSE
[statementblock-n]]
END SELECT
 

In summary all computer programming languages  solve problems using sequencing, selection, iteration and case select control structures.  We will be working with the above control structures when we write code  behind the objects.

Additionally data used during program execution is obtain through three primary ways.

1. Data is stored within the program. VB.Net does this by using a dimensioned array with a list.  For example:

Dim strMonth() as String = {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"}

will store in memory in elements 0 to 11 for the strMonth variable the above data. This is called an initialization list which will automatically set the upper bounds of the array equal to the length of the list.

2. Data is input from the keyboard or other device.  Text boxes are the fields place on dialog boxes and in other windows that allow the user to enter a value. The characters entered into a text box needs to be converted into a numeric value before mathematical operations can be performed. The Val function takes number that are in text format and returns a numeric value that can be used in calculations.

lblTotal.Text=Val(txtPrice.Text) In this example the data contained in the txtPrice.text box will be converted into a number and assigned to the lblTotal.text box.

3. Data is written to or input from a disk storage device.

Creating a project using Microsoft Visual Studio .NET

 Click on new project:

 

 

 

Definitions

A Graphical User Interface (GUI) is the visual part of a program containing forms and controls.

A control is a visual object on the screen that helps the program to communicate with the user by accepting input or displaying output.

Multi-tasking is the process of doing more than one thing at a time.

A front-end program is a client application that connects to a database or other server program.

A back-end program is a server program that accepts connections from client applications.

A multi-processing systems are computers with more than one processor that are capable of handling more data-processing tasks than computers with just a single processor.