Weitere ähnliche Inhalte
Ähnlich wie Vb.net session 01 (20)
Kürzlich hochgeladen (20)
Vb.net session 01
- 1. Introducing .NET
Objectives
In this lesson, you will learn to:
• Identify the types of application architectures
• Identify the components of the .NET Framework
• List the advantages of the .NET Framework
• Identify the components of the Visual Studio .NET Integrated Development
Environment (IDE)
• List the features of Visual Basic .NET
©NIIT Introduction to VB .NET Lesson 1A / Slide 1 of 44
- 2. Introducing .NET
Types of Application Architectures
• The functions performed by an application can be divided into three categories:
• User services provides interactive user interface. Therefore, it is also
called presentation layer.
• Business services ensures that the back-end does not receive incorrect
data.
• Data services comprises data and the functions for manipulating the data.
• Each category is implemented as a layer in an application.
• These three layers form the base of the models or architectures used in
application development.
• Applications may vary from single-tier desktop applications to multi-tier
applications.
©NIIT Introduction to VB .NET Lesson 1A / Slide 2 of 44
- 3. Introducing .NET
Single-Tier Architecture
• In single-tier architecture, a single executable file handles all functions relating
to the user, business, and data service layers.
• Single-tier applications are also called monolithic applications.
©NIIT Introduction to VB .NET Lesson 1A / Slide 3 of 44
- 4. Introducing .NET
Two-Tier Architecture
• The two-tier architecture divides an application into the following two
components:
• Client: Implements the user interface
• Server: Stores data
• In the two-tier architecture, the business services layer may be implemented
in one of the following ways:
• By using fat client
• By using fat server
• By dividing the business services between the user services and the data
services
©NIIT Introduction to VB .NET Lesson 1A / Slide 4 of 44
- 5. Introducing .NET
Three-Tier Architecture
• In three-tier architecture, all the three service layers reside separately, either
on the same machine or on different machines.
• The user interface interacts with the business logic.
• The business logic validates the data sent by the interfaces and forwards it to
the database if it conforms to the requirements.
• The front-end only interacts with business logic, which, in turn, interacts with
the database.
©NIIT Introduction to VB .NET Lesson 1A / Slide 5 of 44
- 6. Introducing .NET
N-Tier Architecture
• An n-tier application architecture is not restricted to a specific number of
layers.
• It has multiple servers handling business services.
• The advantages of n-tier architecture are:
• Extensibility
• Resilience to change
• Maintainability
• Scalability
• These applications serve organization-specific requirements. Therefore, most
modern enterprise applications are based on the n-tier application architecture.
©NIIT Introduction to VB .NET Lesson 1A / Slide 6 of 44
- 7. Introducing .NET
.Net Initiative
• The .NET initiative offers a complete suite for developing and deploying
applications. This suite consists of
• .NET products:
• Microsoft has introduced Visual Studio .NET IDE, which is a tool for
developing .NET applications.
• NET programming languages: Visual Basic, Visual C#, and Visual C++.
• All .NET products use eXtensible Markup Language (XML) for describing
and exchanging data between applications.
• .NET services:
• Web services: A Web service is an application or business logic that is
accessible through standard Internet protocols such as HTTP and SOAP.
• The .NET Framework:
• It is a foundation for developing, designing and deploying applications.
• It exists as a layer between .NET applications and the underlying
operating system.
©NIIT Introduction to VB .NET Lesson 1A / Slide 7 of 44
- 8. Introducing .NET
Components of the .NET Framework
• The .NET Framework consists three main components. They are:
• Common Language Runtime (CLR)
• The .NET Framework Base Classes
• The user interface
©NIIT Introduction to VB .NET Lesson 1A / Slide 8 of 44
- 9. Introducing .NET
Common Language Runtime(CLR)
• The Common Language Runtime (CLR) is the environment where all programs
in .NET run.
• The CLR can host a variety of languages and offer a common set of tools
across languages, ensuring interoperability between the codes.
• Presently, the premier languages for the CLR are Visual Basic, C# (C Sharp),
and C++.
• The applications created in the languages that target the CLR undergo
Managed Code Execution Process.
VB .NET Visual C#
VB .NET Compiler VC# Compiler
Microsoft Intermediate Language (MSIL)
Common Language Runtime (CLR)
Just in Time (JIT) Compilers
Native Code
©NIIT Introduction to VB .NET Lesson 1A / Slide 9 of 44
- 10. Introducing .NET
Common Language Runtime(CLR)
(Contd.)
• Compilation and Execution of a .NET Application
©NIIT Introduction to VB .NET Lesson 1A / Slide 10 of 44
- 11. Introducing .NET
Common Language Runtime(CLR)
(Contd.)
• Features Provided by the CLR:
• Automatic memory management
• Standard type system
• Language interoperability
• Platform independence
• Security management
• Type safety
©NIIT Introduction to VB .NET Lesson 1A / Slide 11 of 44
- 12. Introducing .NET
The .NET Framework Base Classes or
the .NET Class Framework
• The .NET Class Framework Class Library
• is built on the object-oriented nature of the runtime.
• provides classes that can be used in the code to accomplish a range of
common programming tasks, such as string management, data collection,
database connectivity, and file access.
• can be used in a consistent manner across multiple languages.
• comprises namespaces, which are contained within assemblies.
©NIIT Introduction to VB .NET Lesson 1A / Slide 12 of 44
- 13. Introducing .NET
The .NET Framework Base Classes or
the .NET Class Framework (Contd.)
• The .NET Class Framework Class Library includes
• Namespaces help you to
• create logical groups of related classes and interfaces that can be
used by any language targeting the .NET Framework.
• avoid any naming conflicts between classes that have the same
names.
• Assembly
• is a single deployable unit that contains all the information about the
implementation of classes, structures, and interfaces.
• stores all the information about itself. This information is called
metadata.
• provides the CLR with the information required for executing an
application.
• plays an important role in deployment and versioning.
©NIIT Introduction to VB .NET Lesson 1A / Slide 13 of 44
- 14. Introducing .NET
User and Program Interfaces
• .NET provides three types of user interfaces:
• Windows Forms: They are used in Windows-based applications
• Web Forms: They are used in Web-based applications
• Console Applications: They are used to create character-based console
applications that can be executed from the command line.
• .NET provides one program interface:
• Web Services: They are used to communicate with remote components
©NIIT Introduction to VB .NET Lesson 1A / Slide 14 of 44
- 15. Introducing .NET
Advantages of the .NET Framework
• Consistent programming model
• Multi-platform applications
• Multi-language integration
• Automatic resource management
• Ease of deployment
©NIIT Introduction to VB .NET Lesson 1A / Slide 15 of 44
- 16. Introducing .NET
Visual Studio .NET Integrated
Development Environment
• The Visual Studio .NET Integrated Development Environment (IDE)
• provides you with a common interface for developing various kinds of
projects for the .NET Framework .
• provides you with a centralized location for designing the user interface for
the application, writing code, and compiling and debugging the
application.
• is available to all the programmers who use the languages in the Visual
Studio .NET suite.
• The components of the Visual Studio .NET IDE are:
• Projects and Solutions
• User Interface Elements of Visual Studio .NET IDE
• Navigational Features in Visual Studio .NET IDE
©NIIT Introduction to VB .NET Lesson 1A / Slide 16 of 44
- 17. Introducing .NET
Projects and Solutions
• In Visual Studio .NET, an application can be made up of one or more items,
such as files and folders.
• To organize these items efficiently, Visual Studio .NET has provided two types
of containers: Projects and Solutions.
• Project
• allows you to manage, build, and debug the items that make up an
application
• When you build a project, it usually results in the creation of an
executable file (.exe) or a dynamic link library (.dll) also called the
project output.
• Solution
• acts as a container for one or more projects.
• allows you to work on multiple projects within the same instance of the
Visual Studio .NET IDE.
• allows you to specify settings and options that apply to multiple projects.
©NIIT Introduction to VB .NET Lesson 1A / Slide 17 of 44
- 18. Introducing .NET
Projects and Solutions (Contd.)
The following diagram depicts a solution containing multiple projects:
Solution Project 1
Items
Project 1
Project 2
Project 2
Items
Miscellaneous
Files
©NIIT Introduction to VB .NET Lesson 1A / Slide 18 of 44
- 19. Introducing .NET
Creating a Project in Visual Studio
.NET
• You can create a new project in Visual Studio .NET by clicking the New
Project button on the Visual Studio Start Page or by clicking the File
New Project option.
• Then, the New Project dialog box is displayed, as shown in the following
figure :
©NIIT Introduction to VB .NET Lesson 1A / Slide 19 of 44
- 20. Introducing .NET
Creating a Project in Visual Studio
.NET (Contd.)
• In the New Project dialog box, the Project Types pane displays various
categories of projects that can be created. You can create a Visual Basic
project, a Visual C# project, or a Visual C++ project.
• After you select a project type, the templates available for the selected
project type are displayed in the Templates pane.
©NIIT Introduction to VB .NET Lesson 1A / Slide 20 of 44
- 21. Introducing .NET
User Interface Elements of Visual
Studio .NET IDE
Toolbox Menu Bar Windows Forms Designer Solution Explorer
Output Window Windows Form Properties Window
©NIIT Introduction to VB .NET Lesson 1A / Slide 21 of 44
- 22. Introducing .NET
User Interface Elements of Visual
Studio .NET IDE (Contd.)
• In addition to the standard interface elements found in the Windows
environment, such as the menu bar and the toolbar, the Visual Studio .NET
IDE contains other elements. They are:
• The Start Page
• Windows Forms Designer
• The Solution Explorer Window
• The Properties Window
• Toolbox
• The Output Window
• The Task List Window
• The Server Explorer Window
• The Dynamic Help Window
• The Class View Window
• The Code and Text Editor Window
©NIIT Introduction to VB .NET Lesson 1A / Slide 22 of 44
- 23. Introducing .NET
The Start Page
When you start Visual Studio .NET by selecting Start Programs Microsoft
Visual Studio .NET 7.0 Microsoft Visual Studio .NET 7.0, it displays the
Visual Studio .NET Start Page, as shown in the following figure:
©NIIT Introduction to VB .NET Lesson 1A / Slide 23 of 44
- 24. Introducing .NET
Windows Form Designer
• allows you to design the user interface for an application.
• allows you to add controls to a form, arrange them as per your
requirements, and add code to perform some action.
• provides you with a rapid development solution for your application.
©NIIT Introduction to VB .NET Lesson 1A / Slide 24 of 44
- 25. Introducing .NET
Solution Explorer Window
• lists the solution name, the project name, and all the forms and modules
that are used in the project.
• Enables you to open a particular file existing in a project by double-clicking
the file in the Solution Explorer window.
The following figure depicts the Solution Explorer window:
©NIIT Introduction to VB .NET Lesson 1A / Slide 25 of 44
- 26. Introducing .NET
The Properties Window
• displays the properties that are associated with an object.
• is sorted by category, by default.
• The toolbar available for the Properties window allows you to switch
between the sort orders, By category and By alphabets.
The following figure shows the Properties window displaying the properties of a
form:
©NIIT Introduction to VB .NET Lesson 1A / Slide 26 of 44
- 27. Introducing .NET
Toolbox
• The Toolbox displays the tabs Data, Component, Windows Forms,
Clipboard Ring, and General.
• At a time, the items from only a single tab are visible.
Tab
Each tab contains several items, as Item
shown in the figure:
©NIIT Introduction to VB .NET Lesson 1A / Slide 27 of 44
- 28. Introducing .NET
The Output Window
• displays messages for the status of various features provided in the Visual
Studio .NET IDE.
• can be opened by selecting View Other Windows Output or by
pressing the CTRL, ALT, and O keys simultaneously.
The following figure shows the Output window:
©NIIT Introduction to VB .NET Lesson 1A / Slide 28 of 44
- 29. Introducing .NET
The Task List Window
• displays a list of errors along with the source (the file and the line number)
of the error.
• helps you identify and locate problems that are detected automatically as
you edit or compile code.
• can be opened by clicking View Other Windows Task List or by
pressing CTRL, ALT, and K keys simultaneously.
The following figure shows the Task List window:
©NIIT Introduction to VB .NET Lesson 1A / Slide 29 of 44
- 30. Introducing .NET
The Server Explorer Window
• is a handy tool for various administrative tasks such as monitoring the
performance of other machines on a network, and locating and connecting to
the various servers on the network.
• enables you to view the resources of the servers, such as services,
processes, and the event log.
• can be opened by selecting View Server Explorer.
©NIIT Introduction to VB .NET Lesson 1A / Slide 30 of 44
- 31. Introducing .NET
The Dynamic Help Window
• provides you with context-sensitive help.
• is constantly updated to display the links to the help topics on the current
control, component, or keyword.
• can be opened by selecting Help Dynamic Help from the menu bar or by
pressing the CTRL and F1 keys simultaneously.
The following figure depicts the Dynamic Help window:
©NIIT Introduction to VB .NET Lesson 1A / Slide 31 of 44
- 32. Introducing .NET
The Class View Window
• displays the classes, methods, and properties associated with a particular
file.
• can be opened either by selecting View Class View or by pressing the
CTRL, SHIFT, and C keys simultaneously.
When you double-click one of the items in the Class View window, it brings up
the Code Editor window for that item, making it convenient to move through the
code in the project.
The following figure shows the Class View window:
©NIIT Introduction to VB .NET Lesson 1A / Slide 32 of 44
- 33. Introducing .NET
The Code and Text Editor Window
• allows you to enter and edit code and text.
• You may use this window to
• add code for your form.
• create different types of files, such as text files and XML documents. In
such a case, this window is called the Text Editor window.
The following figure shows the Code Editor window:
©NIIT Introduction to VB .NET Lesson 1A / Slide 33 of 44
- 34. Introducing .NET
Navigational Features in Visual Studio
.NET IDE
• The Visual Studio .NET IDE also provides three navigational features. These
are:
• Docking
• Tabbed navigation
• Auto hide
©NIIT Introduction to VB .NET Lesson 1A / Slide 34 of 44
- 35. Introducing .NET
Docking
• This feature allows you to place a window against any of the edges of the
parent window.
• You can make a window dockable by right-clicking the title bar of the window
and checking the Dockable option from the shortcut menu.
The following figure depicts the Toolbox docked against the left edge of the main
window:
©NIIT Introduction to VB .NET Lesson 1A / Slide 35 of 44
- 36. Introducing .NET
Tabbed navigation
• In order to effectively organize the limited space available on the screen,
Visual Studio .NET overlaps various open windows and provides tabs for
navigating from one window to another.
• This feature also provides ease in navigation.
Consider the following figure:
In the figure, the Properties window has overlapped the Dynamic Help window.
©NIIT Introduction to VB .NET Lesson 1A / Slide 36 of 44
- 37. Introducing .NET
Auto hide
• This feature automatically hides a window when it is not in use, thereby
clearing the area occupied by the window.
• To enable this feature, you need to right-click the title bar of the window and
check the Auto Hide option in the shortcut menu.
The following figure depicts the Toolbox window after the Auto Hide feature is
enabled:
When you want to use the Toolbox, you can view it by simply pointing to it.
©NIIT Introduction to VB .NET Lesson 1A / Slide 37 of 44
- 38. Introducing .NET
Introducing Visual Basic .NET
• Visual Basic .NET is one of the languages that are directed towards meeting
the objectives of the .NET initiative of creating distributed applications.
• The key features introduced in Visual Basic .NET are as follows:
• Inheritance
• Constructors and destructors
• Overloading
• Overriding
• Structured exception handling
• Multithreading
©NIIT Introduction to VB .NET Lesson 1A / Slide 38 of 44
- 39. Introducing .NET
Summary
In this lesson, you learned that:
• Applications may vary from single-tier desktop applications (applications that
follow the single-tier architecture) to multi-tier applications (applications that
follow the two-, three-, or n-tier architecture).
• In the case of single-tier architecture, a single executable file handles all
functions relating to the user, business, and data service layers.
• In the case of two-tier architecture, the user and data services are located
separately, either on the same machine or on separate machines.
• In the case of three-tier architecture, all the three service layers reside
separately, either on the same machine or on different machines.
• An n-tier application uses business objects for handling business rules and
data access. It has multiple servers handling business services.
• Most modern enterprise applications are based on the n-tier application
architecture.
• In the current scenario, although applications serve organization-specific
requirements, they are not interoperable.
©NIIT Introduction to VB .NET Lesson 1A / Slide 39 of 44
- 40. Introducing .NET
Summary (Contd.)
• Microsoft has introduced the .NET initiative with the intention of bridging the
gap in interoperability between applications.
• The .NET initiative aims at integrating various programming languages and
services.
• The .NET initiative offers a complete suite of products and services for
developing and deploying applications. In addition, it also provides the .NET
Framework, which encapsulates the basic functionality, such as garbage
collection, debugging, and security services, that was earlier built into
various programming languages.
• The Common Language Runtime (CLR) or the runtime provides functionality
such as exception handling, security, debugging and versioning support to
any language that targets it.
• Some of the features provided by the CLR are as follows:
• Automatic memory management
• Standard type system
• Language Interoperability
• Platform independence
©NIIT Introduction to VB .NET Lesson 1A / Slide 40 of 44
- 41. Introducing .NET
Summary (Contd.)
• Security management
• Type safety
• The .NET Class Framework consists of a class library that works with any
.NET language, such as Visual Basic .NET and C#.
• The .NET Framework class library is built on the object-oriented nature of the
runtime. It provides classes that can be used in managed code to accomplish
a range of common programming tasks, such as string management, data
collection, database connectivity, and file access.
• The .NET Framework class library can be used in a consistent manner across
multiple languages and platforms.
• The .NET Framework class library consists of namespaces that are contained
within assemblies.
• A namespace helps you to create logical groups of related classes and
interfaces that can be used by any language targeting the .NET Framework.
• An assembly is a single deployable unit that contains all the information
about the implementation of classes, structures, and interfaces.
©NIIT Introduction to VB .NET Lesson 1A / Slide 41 of 44
- 42. Introducing .NET
Summary (Contd.)
• An assembly stores all the information about itself. This information is called
metadata and includes the name and version number of the assembly,
security information, information about the dependencies, and a list of the
files that constitute an assembly.
• The user interfaces in .NET Framework comprise Windows Forms, Web Forms
and console applications.
• Windows Forms, Web Forms and Console applications pertain to the
presentation layer of an application.
• Windows Forms are used in Windows-based applications for providing an
interactive user interface.
• Web Forms are used in Web applications for accepting user input and
displaying data.
• Console applications can be executed from the command line.
• The Visual Studio .NET Integrated Development Environment (IDE) provides
you with a common interface for developing Windows and Web applications.
• The IDE provides you with a centralized location for designing the user
interface for the application, writing code, and compiling and debugging the
application.
©NIIT Introduction to VB .NET Lesson 1A / Slide 42 of 44
- 43. Introducing .NET
Summary (Contd.)
• To organize various items of an application efficiently, Visual Studio .NET has
provided two types of containers: projects and solutions.
• A project typically contains items that are interrelated. It allows you to
manage, build, and debug the items that make up an application.
• A solution usually acts as a container for one or more projects. It allows you
to work on multiple projects within the same instance of Visual Studio .NET
IDE. A solution also allows you to specify the settings and options that apply
to multiple projects.
• Some of the components of the Visual Studio .NET IDE are as follows:
• The Windows Forms Designer
• The Solution Explorer window
• The Properties window
• The Toolbox
• The Server Explorer window
• The Output window
• The Dynamic Help window
©NIIT Introduction to VB .NET Lesson 1A / Slide 43 of 44
- 44. Introducing .NET
Summary (Contd.)
• Code and Text Editor window
• In addition to various windows, the Visual Studio .NET IDE also provides
three navigational features. These are:
• Docking
• Tabbed navigation
• Auto hide
• Visual Basic .NET is one of the languages that are directed towards meeting
the objectives of the .NET initiative for creating distributed applications.
• Some of the key features introduced in Visual Basic .NET are as follows:
• Inheritance
• Constructors and destructors
• Overloading
• Overriding
• Structured exception handling
• Multithreading
©NIIT Introduction to VB .NET Lesson 1A / Slide 44 of 44