Lecture 3 - Programming With VB
Lecture 3 - Programming With VB
USING VB.NET
By:
Collinson Colin Agbesi
Recommended Textbooks
1. Mike Snell & Lars Powers; “Microsoft Visual Studio 2010
Unleash” Pearson Education, Inc.
2. Evangelos Petroutsos, “Mastering Microsoft Visual Basic
2010”, Wiley Publishing Inc.
HISTORY OF VB.NET
This version of the language itself was not quite compatible with Visual Basic for Windows.
Visual Basic
September 1992 DOS This was because the language was actually the next version of Microsoft's DOS-based
1.0
BASIC compilers, QuickBASIC and BASIC Professional Development System.
The programming environment was easier to use than the 1.0 version, and it was more fast.
Visual Basic
November 1992 Windows Notably, forms became instantiable objects, thus laying the founding concepts of class
2.0
modules as were later offered in version 4.0.
Visual Basic Visual Basic 3.0 came in Standard and Professional versions. VB3 included version 1.1 of
Summer 1993 Windows
3.0 the Microsoft Jet Database Engine that could read and write Jet (or Access) 1.x databases.
This was the first version that can create 32-bit applications as well as 16-bit Windows
Visual Basic
August 1995 Windows programs. It has three editions; Standard, Professional, and Enterprise. It also introduced the
4.0
ability to write non-GUI classes in Visual Basic.
This version was released exclusively for 32-bit versions of Windows. Programmers who
Visual Basic preferred to write 16-bit programs were able to import programs written in Visual Basic 4.0
February 1997 Windows
5.0 to Visual Basic 5.0, and Visual Basic 5.0 programs can easily be converted with Visual
Basic 4.0
This version improved in a number of areas including the ability to create web-based
Visual Basic applications. VB6 entered Microsoft's "non-supported phase" as of March 2008. Although
Mid 1998 Windows
6.0 the Visual Basic 6.0 development environment is no longer supported, the runtime is
supported on Windows Vista, Windows Server 2008 and Windows 7.
HISTORY OF VB.NET
VB.NET Releases
Version Date Released Description
VB.NET 7.0 2002 The first version, Visual Basic .NET, relies on .NET Framework 1.0
VB.NET 7.1 2003 Visual Basic .NET 2003 was released with .NET Framework 1.1
VB.NET 8.0 2005 Microsoft dropped ".NET" from the name of the product, calling the next
version Visual Basic 2005.
VB.NET 9.0 2008 Visual Basic 9.0 was released along with .NET Framework 3.5
VB.NET 10.0 2010 Microsoft had planned to use Dynamic Language Runtime (DLR) for that
release but shifted to a co-evolution strategy between Visual Basic and
C# to bring both languages into closer parity with one another.
VB.NET 11.0 2012 Visual Basic 2012 was released along .NET Framework 4.5
VB.NET 12.0 2013 Visual Basic 2013 was released along .NET Framework 4.5.1 with Visual
Studio 2013
VB.NET 14.0 2015 Visual Basic 2015 (code named VB "14.0") has been released with
Visual Studio 2015
VB.NET 15.0 2017 Visual Basic 2017 (code named VB "15.0") has been released with
Visual Studio 2017
VB.NET 16.0 2019 Visual Basic 2019 (code named VB "16.0") has been released with
Visual Studio 2019
HISTORY OF VB.NET
.NET 2.0 January, Version 2.0 was released along with Visual Studio 2005, Microsoft SQL Server 2005, and BizTalk 2006. .NET Framework 2.0 is
supported on Windows 98, ME, 2000, XP, Server 2003, Vista, Server 2008, and Server 2008 R2
2006
.NET 3.0 November, .NET Framework 3.0, was formerly called WinFX. It includes a new set of managed code APIs that are an integral part of
Windows Vista and Windows Server 2008. It is also available for Windows XP SP2 and Windows Server 2003
2006
.NET 3.5 November, As with .NET Framework 3.0, version 3.5 uses Common Language Runtime (CLR) 2.0, that is, the same version as .NET
Framework version 2.0.
2007
.NET 4.0 April, 2010 .NET framework 4.0 was developed for parallel extensions to support parallel computing, VB.NET, C#, common runtime language
4.0. .NET Framework 4.0 is supported on Windows XP (with Service Pack 3), Windows Server 2003, Vista, Server 2008, 7 and
Server 2008 R2.
.NET 4.5 August, .NET Framework 4.5 includes a set of new or improved features The .NET Framework 4.5 is only supported on Windows Vista or
later. The .NET Framework 4.5 uses Common Language Runtime 4.0, with some additional runtime features. .Net Framework
2012
4.5.1 was released October, 2013 and .Net Framework 4.5.2 was released May, 2014
.NET 4.6 July, 2015 .NET Framework 4.6 supports a new just-in-time compiler (JIT) for 64-bit systems called RyuJIT, which features higher
performance and support for SSE2 and AVX2 instruction sets. .NET framework 4.6.1 was released November 2015 and .NET
framework 4.6.2 is released August, 2016
.NET 4.7 April, 2017 Microsoft announced that .NET Framework 4.7 was integrated into Windows 10 Creators Update, promising a standalone installer
for other Windows versions. .NET framework 4.7.1 was released October, 2017 and .NET framework 4.7.2 was released April,
2018
.NET 4.8 April, 2019 .NET Framework includes additional enhancements for high-resolution displays, performance updates, and security
enhancements. .NET Framework 4.8 is supported on Windows 7, Server 2008 R2, Server 2012, 8.1, Server 2012 R2, 10, Server
2016 and Server 2019
HISTORY OF VB.NET
Console applications
Windows GUI apps or Windows Forms
Windows Presentation Foundation (WPF) apps.
ASP.NET applications
Windows services
Service-oriented apps using Windows Communication
Foundation (WCF)
Workflow-enabled apps using Windows Workflow
Foundation (WF)
ADVANTAGES OF VB.NET:
Some merits / pros and benefits of VB.NET includes;
Easy development and deployment of applications using rapid
application development and wizards etc
Automatic formatting of codes and autocorrect features
Object-oriented constructs to create an enterprise-class code
Create web applications with modern features like performance
counters, event logs, file system using visual form designers.
Drag and drop capability to replace any elements or items that
you may need.
Connect applications to other applications created in languages
that run on the .NET framework.
Additional features like docking, automatic control anchoring,
and in-place menu editor for developing web applications.
Large talent pool and knowledge based means there are many
VB.NET programmers so you can easily find help on any
HISTORY OF VB.NET
DISADVANTAGES OF VB.NET
Some demerits / cons and drawbacks of VB.NET includes;
Cannot handle pointers directly – This means more coding required
to handle a pointer. Additional coding results in additional CPU cycles;
which in turn requires additional processing time; which results in
slower applications. The application becomes slow.
Intermediate Language (IL) compilation – These types of compilers
can be easily decompiled (a.k.a Reverse Engineered); there is little that can be
done to deter decompiling of the application, and nearly nothing that can be done
to prevent it.
Just-In-Time (JIT) compiler – JIT compiling is the way the computer can
interpret the IL compilation. This is essential to running the application. This
means the target computer will be required to have JIT and that the application
can receive performance degradation because of the extra CPU cycles required to
use JIT.
Large Libraries – Because VB is an IL there is a large number of libraries
required for the JIT compiler to interpret the application. Large libraries require
more hard drive space, more computing time and most of all it can be a nuisance
if the application is being deployed over the internet and the user must obtain
these libraries in addition to the files of the compiled application.
HOW TO GET STARTED
The panel (in light blue) shows the source code for our first
program. The light blue numbers represent the line numbers
and are not part of the program but are shown for
informational purposes.
STRUCTURE OF VB.NET PROGRAM
The previous program is the typical program that programmers
write for the first time, and its output is the displaying on the
PC screen the texts "Hello World”. It is one of the simplest
programs that can be written in C++, but it already contains
the fundamental components that every C++ program has. We
are going to look line by line at the code we have just written.
Sub Main()
This line corresponds to the beginning of the main function.
The main function is the point where all VB.NET programs start
their execution, independently of its location within the source
code. It does not matter whether there are other functions with
other names defined before or after it - the instructions
contained within the Main() function will always be the first
ones to be executed in any program. So it is very essential that
all VB.NET programs have a main function.
Read() or ReadLine()
The Read() or ReadLine() functions is used to accept input
from the user whenever the main function finishes it work. This
would prevent the output screen from disappearing after
execution of the program. The Read() or ReadLine() is used to
stop or pause the output screen after the program executes its
instructions. This is the most usual way to end a console
program in VB.NET console program. It is used to accept input
from the user. This command prevents the window from
closing after execution because the program still awaits an
input from the user.
You may have noticed that not all the lines of this program
perform actions when the code is executed. Some lines contain
only comments. There were lines with directives for the
compiler's preprocessor to import the standard input-output
functions. Also there were lines that began the declaration of a
the main function and, finally lines with statements, which are
included within the body of the main function.
STRUCTURE OF VB.NET PROGRAM
Console Application 2