Visual Basic .Net - Chapter 1
.Net Framework
• New, easy and extensive programming platform
• Support several programming lanugages including
VB.NET, C# (C Sharp), J# and managed C++
• Common Class Library
• DOS to Windows is similar to Microsoft is moving to .NET
• VB is easy but not flexible for complex applications
• VC++ is a powerful tool but it is difficult.
• VC++ had too many data types and programmers had to
learn many libraries including Windows SDK, MFC, ATL,
COM etc.
.Net Framework
• Java became a good choice for these reasons. It had the
flexibility and power of C++
• Microsoft recognized these factors and remove all
unwanted complexities were eliminated and pure OOPS
model was introduced
• .NET has a single class library
• After compiling the code in any .NET language, it will be
converted to an Intermediate Language (Microsoft
Intermediate Language - MSIL)
.Net Framework
• The same .NET Framework executes the VB.NET and C#
applications
• VB.NET is platform independent and so it runs anywhere
• SQL server also supprts writing stored procedures in
.NET languages.
• If we use Microsoft technologies for programming, .NET
will be the only choice
.Net Framework
• Two components - CLR (Common Language Runtime),
.NET Framework Class library
• CLR is the heart of the .NET framework
• CLR manages the VB.NET code execution, memory
allocation, code compilation and garbage collection
• CTS - Common Type System - Ensures strict type safety -
System.Int32 datatype in MSIL
.Net Framework
• .Net Framework Class Library - Collection of useful and
reusble classes and interfaces
• Class Library - Object oriented and fully inheritable
• Using this, we can develop traditional windows based
application to the latest web based applications
• Namespace - Logical grouping of related classes
• Class Library - Organized hierarchically
• Root of .Net Base class - System
• Other namespaces can be accessed with the root
operator
.Net Framework
• System.Math
• System.Data
• System.Windows.Forms
• System.Exception
• System.Threading
• System.IO
• System.Net
• System.Web.Services
• System.Diagnostics
.Net Framework
• Cross Language Compatibility - Interoperability
• It is possible by CLR.
• CLS - Common Language Specification - Defines the
minimum standard
• VB.NET Compiler - vbc
• VC#.NET Compiler - csc
DLL - Dynamic Link Library
• Code Reusability - C, C++ - Static function library (.lib)
files
• When the function sqrt() used in the program, the pre-
defined code for the sqrt() function was included in that
program
• To avoid the wastage of memory space, Microsoft
suggested the concept of DLL
• It was never included in a program that invoked that
function.
• Linked with the invoking program at run-time
• Programmer shall place a DLL either in their working
directory or in the windows/system directory
• Operating system will take care of proper linking of a dll
function code with the invoking program at run-time
• DLL concept led to some problems - DLL HELL
• Location Transparency
• Problems are solved by COM - An application is
developed as a collection of independent pieces of
software
• Each such independent piece of software is known as
component
• COM is object oriented and binary standard
• Communicate with each other through interfaces
• It is identified by GUID(Globally Unique Identifiers)
• It is registered in the system registry
Assemblies
• Code reuability is achieved through assemblies
• .Net code on compilation is stored in an assembly
• Assembly contains assembly metadata, type metadata
and resources
• Assembly Metadata - Manifest - Provides the data about
.NET component - Contains more information than a type
library
• Type Metadata - Includes data about the classes exported
from the assembly
• Assembly metadata and Type metadata are collectively
known as metadata
• Two different versions of an assembly can be used inside
a single application
• Two types of assemblies - Private and Shared
• DLL, EXE - Private assembly
VB.NET Language
• There is not much common between the earlier visual basic and
VB.NET
• Very few similarities between them
• VB.NET C# code will get converted to MSIL. It is this MSIL which
will deliver to the customer in the form of DLL or EXE
• Powerful and user-friendly
• VB specific runtime was replaced by the Common Language
Runtime
• Excellent support for Windows-based and Web-based
applications
• VB.NET combines the productivity and user-friendliness of VB,
power of C++ and elegance of java.
Features of VB.NET
• Object Oriented language
• Consistent - It supports unified data type system
• Managed by CLR - Makes VB.Net compact and safer
• Dispenses with bug-prone features such as multiple
inheritance and preprocessor macros.
• Type-safe measures have been incorporated into
VB.NET. Unsafe type casting is not permitted - Garbage
Collection
• Classes are declared and defined in the same code
blocks. It makes the management of the classes quite
Features of VB.NET
• Makes the development and implement the components
easily. It help us to handle several real life applications
• New version of a component can work with and existing
application without creating any problem - overcomes the
DLL hell problem
• Creating a windows based applications in VB.Net is very
easy
• Develop very efficient web-based applications with
dynamic web content
• Writing web services is simple
Development of a simple vb.net program
' Namespace declaration
Imports System
'Class definition
Class Class1
'Main() Method definition
Shared Sub Main()
'WriteLine() method invocation
Console.WriteLine(“Welcome to learn VB.NET”)
End Sub
• Namespace - Logical collection of related classes.
System is an important namespace
• Console is an important class in the System namespace
• For compiling
C:FolderName > vbc Class1.vb
• For executing
C:FolderName > Class1
Compilation and Execution
• VB.NET code is not converted into binary machine code.
• It is converted to MSIL code - Low level CPU independent
designed to be read and understood by CLR
• It will contain one or more assemblies
• When the execution starts, the first assembly is loaded into
memory. At this time,CLR examines the assembly manifest
and determines the requirements to execute the application
and creates a process for the application and begins the
application's execution
• The first part of the code is loaded into memory. Then it is
converted into machines code from MSIL code.It is done by
CLR's Just-In-Time Compiler.(JIT)
• Such native binary code is stored in memory
• As only the parts of a program that are executed are
compiled in this way, the applications's performance is
always maximized
• IDE- Visual Studio .NET

Presentation1.pptx

  • 1.
    Visual Basic .Net- Chapter 1
  • 2.
    .Net Framework • New,easy and extensive programming platform • Support several programming lanugages including VB.NET, C# (C Sharp), J# and managed C++ • Common Class Library • DOS to Windows is similar to Microsoft is moving to .NET • VB is easy but not flexible for complex applications • VC++ is a powerful tool but it is difficult. • VC++ had too many data types and programmers had to learn many libraries including Windows SDK, MFC, ATL, COM etc.
  • 3.
    .Net Framework • Javabecame a good choice for these reasons. It had the flexibility and power of C++ • Microsoft recognized these factors and remove all unwanted complexities were eliminated and pure OOPS model was introduced • .NET has a single class library • After compiling the code in any .NET language, it will be converted to an Intermediate Language (Microsoft Intermediate Language - MSIL)
  • 4.
    .Net Framework • Thesame .NET Framework executes the VB.NET and C# applications • VB.NET is platform independent and so it runs anywhere • SQL server also supprts writing stored procedures in .NET languages. • If we use Microsoft technologies for programming, .NET will be the only choice
  • 5.
    .Net Framework • Twocomponents - CLR (Common Language Runtime), .NET Framework Class library • CLR is the heart of the .NET framework • CLR manages the VB.NET code execution, memory allocation, code compilation and garbage collection • CTS - Common Type System - Ensures strict type safety - System.Int32 datatype in MSIL
  • 6.
    .Net Framework • .NetFramework Class Library - Collection of useful and reusble classes and interfaces • Class Library - Object oriented and fully inheritable • Using this, we can develop traditional windows based application to the latest web based applications • Namespace - Logical grouping of related classes • Class Library - Organized hierarchically • Root of .Net Base class - System • Other namespaces can be accessed with the root operator
  • 7.
    .Net Framework • System.Math •System.Data • System.Windows.Forms • System.Exception • System.Threading • System.IO • System.Net • System.Web.Services • System.Diagnostics
  • 8.
    .Net Framework • CrossLanguage Compatibility - Interoperability • It is possible by CLR. • CLS - Common Language Specification - Defines the minimum standard • VB.NET Compiler - vbc • VC#.NET Compiler - csc
  • 10.
    DLL - DynamicLink Library • Code Reusability - C, C++ - Static function library (.lib) files • When the function sqrt() used in the program, the pre- defined code for the sqrt() function was included in that program • To avoid the wastage of memory space, Microsoft suggested the concept of DLL • It was never included in a program that invoked that function. • Linked with the invoking program at run-time
  • 11.
    • Programmer shallplace a DLL either in their working directory or in the windows/system directory • Operating system will take care of proper linking of a dll function code with the invoking program at run-time • DLL concept led to some problems - DLL HELL • Location Transparency • Problems are solved by COM - An application is developed as a collection of independent pieces of software • Each such independent piece of software is known as component
  • 12.
    • COM isobject oriented and binary standard • Communicate with each other through interfaces • It is identified by GUID(Globally Unique Identifiers) • It is registered in the system registry
  • 13.
    Assemblies • Code reuabilityis achieved through assemblies • .Net code on compilation is stored in an assembly • Assembly contains assembly metadata, type metadata and resources • Assembly Metadata - Manifest - Provides the data about .NET component - Contains more information than a type library • Type Metadata - Includes data about the classes exported from the assembly • Assembly metadata and Type metadata are collectively known as metadata
  • 14.
    • Two differentversions of an assembly can be used inside a single application • Two types of assemblies - Private and Shared • DLL, EXE - Private assembly
  • 15.
    VB.NET Language • Thereis not much common between the earlier visual basic and VB.NET • Very few similarities between them • VB.NET C# code will get converted to MSIL. It is this MSIL which will deliver to the customer in the form of DLL or EXE • Powerful and user-friendly • VB specific runtime was replaced by the Common Language Runtime • Excellent support for Windows-based and Web-based applications • VB.NET combines the productivity and user-friendliness of VB, power of C++ and elegance of java.
  • 16.
    Features of VB.NET •Object Oriented language • Consistent - It supports unified data type system • Managed by CLR - Makes VB.Net compact and safer • Dispenses with bug-prone features such as multiple inheritance and preprocessor macros. • Type-safe measures have been incorporated into VB.NET. Unsafe type casting is not permitted - Garbage Collection • Classes are declared and defined in the same code blocks. It makes the management of the classes quite
  • 17.
    Features of VB.NET •Makes the development and implement the components easily. It help us to handle several real life applications • New version of a component can work with and existing application without creating any problem - overcomes the DLL hell problem • Creating a windows based applications in VB.Net is very easy • Develop very efficient web-based applications with dynamic web content • Writing web services is simple
  • 18.
    Development of asimple vb.net program ' Namespace declaration Imports System 'Class definition Class Class1 'Main() Method definition Shared Sub Main() 'WriteLine() method invocation Console.WriteLine(“Welcome to learn VB.NET”) End Sub
  • 19.
    • Namespace -Logical collection of related classes. System is an important namespace • Console is an important class in the System namespace • For compiling C:FolderName > vbc Class1.vb • For executing C:FolderName > Class1
  • 20.
    Compilation and Execution •VB.NET code is not converted into binary machine code. • It is converted to MSIL code - Low level CPU independent designed to be read and understood by CLR • It will contain one or more assemblies • When the execution starts, the first assembly is loaded into memory. At this time,CLR examines the assembly manifest and determines the requirements to execute the application and creates a process for the application and begins the application's execution • The first part of the code is loaded into memory. Then it is converted into machines code from MSIL code.It is done by CLR's Just-In-Time Compiler.(JIT)
  • 21.
    • Such nativebinary code is stored in memory • As only the parts of a program that are executed are compiled in this way, the applications's performance is always maximized • IDE- Visual Studio .NET