Unit 1 Introduction A Brief Description of Visual Basic 2010
Unit 1 Introduction A Brief Description of Visual Basic 2010
Unit 1 Introduction A Brief Description of Visual Basic 2010
.NET framework provides a rich set of functionality out of the box. It contains hundreds of classes that
provide variety of functionality ready to use in your applications. This means that as a developer you
need not go into low level details of many operations such as file IO, network communication and so on.
Easy development of web applications
ASP.NET is a technology available on .NET platform for developing dynamic and data driven web
applications. ASP.NET provides an event driven programming model (similar to Visual Basic 6 that
simplify development of web pages (now called as web forms) with complex user interface. ASP.NET
server controls provide advanced user interface elements (like calendar and grids) that save lot of coding
from programmers side.
OOPs Support
The advantages of Object Oriented programming are well known. .NET provides a fully object oriented
environment. The philosophy of .NET is Object is mother of all. Languages like Visual Basic.NET
now support many of the OO features that were lacking traditionally. Even primitive types like integer
and characters can be treated as objects something not available even in OO languages like C++.
Multi-Language Support
Generally enterprises have varying skill sets. For example, a company might have people with skills in
Visual Basic, C++, and Java etc. It is an experience that whenever a new language or environment is
invented existing skills are outdated. This naturally increases cost of training and learning curve. .NET
provides something attractive in this area. It supports multiple languages. This means that if you have
skills in C++, you need not throw them but just mould them to suit .NET environment. Currently four
languages are available right out of the box namely Visual Basic.NET, C# (pronounced as C-sharp),
Jscript.NET and Managed C++ (a dialect of Visual C++). There are many vendors that are working on
developing language compilers for other languages (20+ language compilers are already available). The
beauty of multi language support lies in the fact that even though the syntax of each language is
different, the basic capabilities of each language remain at par with one another.
Multi-Device Support
Modern lift style is increasingly embracing mobile and wireless devices such as PDAs, mobiles and
handheld PCs. . .NET provides promising platform for programming such devices. .NET Compact
Framework and Mobile Internet Toolkit are step ahead in this direction.
Automatic memory management
While developing applications developers had to develop an eye on system resources like memory.
Memory leaks were major reason in failure of applications. .NET takes this worry away from developer
by handling memory on its own. The garbage collector takes care of freeing unused objects at
appropriate intervals.
No more DLL Hell
If you have worked with COM components, you probably are aware of DLL hell. DLL conflicts are a
common fact in COM world. The main reason behind this was the philosophy of COM one version of
component across machine. Also, COM components require registration in the system registry. .NET
ends this DLL hell by allowing applications to use their own copy of dependent DLLs. Also, .NET
components do not require any kind of registration in system registry.
Strong XML support
Navin Malla Birendranagar 11 Airport Surkhet 9848161363
E-Mail: SKmalla45@gamail.com
Now days it is hard to find a programmer who is unaware of XML. XML has gained such a strong
industry support that almost all the vendors have released some kind of upgrades or patches to their
existing software to make it XML compatible. Currently, .NET is the only platform that has built with
XML right into the core framework. .NET tries to harness power of XML in every possible way. In
addition to providing support for manipulating and transforming XML documents, .NET provides XML
web services that are based on standards like HTTP, XML.
Security
Windows platform was always criticized for poor security mechanisms. Microsoft has taken great efforts
to make .NET platform safe and secure for enterprise applications. Features such as type safety, code
access security and role based authentication make overall application more robust and secure.
The .NET Platform Architecture
The .NET is a framework that covers all the layers of software development above the Operating
System. It provides the richest level of integration among presentation technologies, component
technologies, and data technologies ever seen on Microsoft, or perhaps any, platform. Secondly, the
entire architecture has been created to make it easy to develop Internet applications, as it is to develop
for the desktop.
Constituents of .NET Platform
The .NET consists of the following three main parts
.NET Framework a completely re-engineered development environment.
.NET Products applications from MS based on the .NET platform, including Office and Visual
Studio.
.NET Services facilitates 3rd party developers to create services on the .NET Platform.
Operating System
Memory management : one of the most important services that the CLR provides during managed
execution is the automatic memory management. The CLR uses the garbage collector to manage the
allocation and release of memory for an application.
.NET Framework class Library :
The next layer up in the framework is called the .NET Class Framework also referred as .NET base class
library. The .NET Class Framework consists of several thousand type definitions, where each type
exposes some functionality.
It facilitate interoperability between language, . NET framework should be CLS (common language
specification) compliant so that they can used from any programming language whose compiler
conforms to the CLS.
NET application, components, and controls are built on the foundation of .NET framework types. These
entities perform the following functions.
a. Represent base data types and exceptions
b. Encapsulating data structure.
c. Perform input and output operation etc
The framework class library (FCL) is a huge library of reusable types meant to use by managed code. It
is an object-oriented library that is used in component based application. The FCL is made up of a
hierarchy of namespaces that expose classes, structures, interfaces, enumerations. Names spaces are
logically defined by their functionality. For example the System.Data namespace contains the
functionality available for accessing database. There are more than 20,000 classes in FCL. All logically
grouped in a hierarchical manner .
The following points need to be remembered while using the FCL.
1. The classes, interfaces, structures and enumerated values collectively referred to as type.
2. The different types in the framework are arranged in a hierarchy of namespaces. This solves the problem
faced in name collisions.
3. We may write a code that uses a stream class in IL, these types are represented as System.IO.Stream.
Metadata and Assemblies : metadata is library information that describes your program stored in a
CLR portable executable(PE) file or the memory. When compilation of the code takes place in a PE file,
the metadata is inserted into one-part of the file, while the code is converted into IL and inserted into the
other part of the file. The metadata describes every type and member. When the code is in the run mode,
the CLR loads the metadata into the memory and finds information about the codes class and members.
A metadata describes information about the code in a language-neutral manner. The metadata contains
the following.
1. Assembly information, which includes the metadata identity that can be name, version, culture, public
key, other referenced assemblies, and security permissions.
2. Information about type such as name, visibility, base classes ,interfaces used members.
3. Attribute information that modifies the types and members of a class.
After providing the listed information, CLR is able to create objects, access data and call members.
Assemblies are packaged into units containing programs and libraries. An assebly contains a selfdescribing binary file that can be either Dynamic link library file or executable file. An asseble contains
code that CLR executes.
Navin Malla Birendranagar 11 Airport Surkhet 9848161363
E-Mail: SKmalla45@gamail.com
Asseblies can be of two types, static or dynamic. Static assemblies include interfaces, classes and
resources. These asseblies are saved in the PE on a disk. Other hand dynamic asseblies run directly
from the memory without being saved to disk before execution.
Assembly manifest : every assembly contains data that describes how elements are related to each
other withing assembly. the manifiest also known as assebly manifest, contains the assembly needed for
providing the assembly's verson requirements and security identity. the menifiest can be stored either in
a PE with IL code or in a standalone PE file that contains only the manifiest information table.
assebly name
version number
culture
Global Assebly Catche: GAC is the central place for registering assemblies, so that different
application on the computer can use it later on. CLR is installed on the achine-wide codecache in a
computer.
Strong Name Asseblies: A strong name assemblies the assembly's identity, that is the information about
the assembly's name, version number, culture, public key, and digital signature.
private and shared asseblies: when a single computer uses an assembly then it is called as a private
assembly.
shared assemblies are those assemblies that are placed in the global assembly cache so that they can be
used by multiple applications.
Side by side exxecution : the process of executing multiple versions of an application or an assembly is
known as side-by-side execution.
LINQ :- LINQ is one of the components of .NET framework 4.0. that adds native data query
capabilities to .NET language by using systax similar to SQL.
The following is a simple query in VB.
Dim query = from s in students where s.gender=m
Select s.name
When you execute the preceding query, it returns thename of all the male students and is stored in the
Navin Malla Birendranagar 11 Airport Surkhet 9848161363
E-Mail: SKmalla45@gamail.com
variable query. To print that list, you have to write the following lines of code.
For each name is query
Response.write(name)
Next
It is import to note that it is looks similar to SQL. The LINQ query displayed is not an SQL
statement. Instread it is purely VB language.
Though LINQ queries resembles SQL, they are not restricted to access only relational database.
LINQ enabled data access componets are as follows.
a. LINQ to ADO.NET : includes two options to SQL which translates a query into an SQL query and
then issues it against the tables specified in the query in an SQL server database and LINQ to Data Set
which execute the query on the components of a DataSet.
b. LINQ to Object :- allows querying objects in a collection. LINQ to Objects is not dynamic. After
creating and using the result set, any changes made to the source collection do not automatically update
the result set.
c. LINQ to SQL: allows querying of XML data. In addition, it helps in creating and manipulating XML
data. This option has a different syntax. The basic LINQ remains the same.
the users can extend the applications, which are created using dynamic language.
3. Managed extensibility Framework:- the MEF is a new library included in framework 4.0 to create
lightweight and extensible applications. In other words it helps in simplifying the creations of extensible
application.
4. Parallel Computing:- this features allowed to run multiple thread simultaneously. It means, large
program can be divided into small-2 program and all these programs can run at same time.
5. Improved Security:- there are many changes made on code access security(CAS) system. There are
many useful classes and services introduced in CLR and .NET framework that help the developers to
write secure code and implement cryptography and role based security.
6. Networking Improvements :- there are various improvements made on networking .
a. Windows authentication like as System.Net.HttpWebRequest. System.Net.HttpListener, etc
b. It supports Ipv6 internet protocol.
c. Introduction of Add Range in the System.Net.HttpWebRequest.class.
7. Improved Entity Framework :- in this version of .NET framework. There is less amount of coding in
entity framework. The amount maintenance required for data driven application has also been reduced
by allowing we to program against data models. It also support to create N Tier application.
Provides support for Web, Mobile, Windows, and Office application development.
Integrates with the .NET Framework 4.0.
Developing Visual Studio 2010 Application (Project)
In Visual Studio 2010, you can develop mainly the following types of applications:
Console applications
Window Forms application
Web applications
Developing a Console Application
A console application refers to a .NET application that does not have Graphical User Interface (GUI) except for
a command-line console. The users of a console application interact with the application only through the
command line console, implying the data is displayed and read through the command line. This makes console
application suitable for situations where less user interaction is required. Visual Studio provides a project
template which offers you an easy way to develop console application.
Eg:
Module Module1
Sub Main()
Console.WriteLine("Wel Come to Visual Studio 2010")
Console.ReadLine()
End Sub
End Module
The WriteLine method of the Console class is used to display a message on the command-line console. When
this line of code is executed, the message, First Console Application, is displayed on the command-line console.
The ReadLine method of the Console class is used to read the next line of characters from the console.
Imports System.Console
Module Module1
Sub Main()
WriteLine("Welcome to Visual Studio 2010")
Read()
End Sub
End Module
Navin Malla Birendranagar 11 Airport Surkhet 9848161363
E-Mail: SKmalla45@gamail.com
Console.WriteLine(message)
Console.ReadLine()
End Sub
End Module
Working with Visual Basic Operator (Windows Forms Application)