Вы находитесь на странице: 1из 8

1 Chapter1: Visual Basic .NET and the .

NET Framework

Unit 1: Visual Basic .NET and the .NET Framework

Contents
Introduction to .net framework Features
Common Language Runtime (CLR)
Framework Class Library(FCL)
Visual Studio.Net IDE, Languages Supported, Features.
Visual Programming,
VB.net- Components of IDE- Menu System, Toolbars, Code Designer, Solution Explorer,
Object Browser, Toolbox, Class View Window, Properties Window, Server Explorer, Task
List, Output Window, Command Window.

Introduction to .net framework


The .NET Framework defines an environment that supports the development and execution of highly
distributed, component-based applications. It enables differing computer languages to work
together and provides for security, program portability, and a common programming model for the
Windows platform. As it relates to VB, the .NET Framework defines two very important entities. The
first is the Common Language Runtime (CLR). This is the system that manages the execution of your
program. Along with other benefits, the Common Language Runtime is the part of the .NET
Framework that enables programs to be portable, supports mixed-language programming, and
provides for secure execution.

The second entity is the .NET class library. This library gives your program access to the runtime
environment. For example, if you want to perform I/O, such as displaying something on the screen,
you will use the .NET class library to do it.

Prof. Sushant Sundikar VISUAL BASIC.NET


2 Chapter1: Visual Basic .NET and the .NET Framework

Design Features
Interoperability
Because computer systems commonly require interaction between newer and older applications,
the .NET Framework provides means to access functionality implemented in newer and older
programs that execute outside the .NET environment. Access to COM components is provided in the
System.Runtime.InteropServices and System.EnterpriseServices namespaces of the framework.

Common Language Runtime engine


The Common Language Runtime (CLR) serves as the execution engine of the .NET Framework. All
.NET programs execute under the supervision of the CLR, guaranteeing certain properties and
behaviours in the areas of memory management, security, and exception handling.

Language independence
The .NET Framework introduces a Common Type System, or CTS. The CTS specification defines all
possible datatypes and programming constructs supported by the CLR and how they may or may not
interact with each other conforming to the Common Language Infrastructure (CLI) specification.
Because of this feature, the .NET Framework supports the exchange of types and object instances
between libraries and applications written using any conforming .NET language.

Base Class Library


The Base Class Library (BCL), part of the Framework Class Library (FCL), is a library of functionality
available to all languages using the .NET Framework. The BCL provides classes that encapsulate a
number of common functions, including file reading and writing, graphic rendering, database
interaction, XML document manipulation, and so on. It consists of classes, interfaces of reusable
types that integrates with CLR (Common Language Runtime).

Simplified deployment
The .NET Framework includes design features and tools which help manage the installation of
computer software to ensure it does not interfere with previously installed software, and it
conforms to security requirements.

Security
The design addresses some of the vulnerabilities, such as buffer overflows, which have been
exploited by malicious software. Additionally, .NET provides a common security model for all
applications.

Portability
While Microsoft has never implemented the full framework on any system except Microsoft
Windows, it has engineered the framework to be platform-agnostic, and cross-platform
implementations are available for other operating systems . Microsoft submitted the specifications
for the Common Language Infrastructure (which includes the core class libraries, Common Type
System, and the Common Intermediate Language), the C# language, and the C++/CLI language to
both ECMA and the ISO, making them available as official standards. This makes it possible for third
parties to create compatible implementations of the framework and its languages on other
platforms.

Prof. Sushant Sundikar VISUAL BASIC.NET


3 Chapter1: Visual Basic .NET and the .NET Framework

The Common Language Runtime


The Common Language Runtime (CLR) is the heart of .NET. CLR takes your .NET application, compiles
it into native processor code, and runs it.

Any Visual Basic .NET applications, class libraries, and components live in two realities. The
design:;me reality is where you write source code, create classes and objects, design applica;ons,
debug, and compile your code. The runtime reality is an external environment and for .NET
managed:code applica;ons, this environment is the common language run;me, be<er known as
the CLR. It is the runtime and managed:execu;on environment in which all .NET applica;ons are
allowed to process. Code that targets the CLR is called managed code, indicating that its execution in
the runtime environment is managed by the CLR.

The CLR is the execution environment provided by the Microsoft .NET Framework. It provides many
services such as

Automatic garbage collection


Code access security
Simplified versioning
Simple and reliable deployment
Deep cross-language interoperability
Debugging across different languages
Performance
Scalability

Microsoft Intermediate Language


When you compile your Visual Basic .NET source code, it is changed to an intermediate language (IL)
that the CLR and all other .NET development environments understand. All .NET languages compile
code to this IL, which is known as Microsoft Intermediate Language, MSIL, or IL.

Figure 1-1 (on the next page) shows what happens to your code from its inception in Visual Studio to
execution.

Figure 1-1

Prof. Sushant Sundikar VISUAL BASIC.NET


4 Chapter1: Visual Basic .NET and the .NET Framework

Framework Class Library (FCL)


The Framework Class Libraries (FCL) provides the fundamental building blocks for any application
you develop, be it an ASP.Net application , a Windows Forms application, or a Web Service. The FCL
generally serves as your main point of interaction with the runtime. FCL classes include

System-Includes essential classes and base classes that define commonly used data types,
events and event handlers, interfaces, attributes, exceptions, and so on.
System.Collections-Includes interfaces and classes that define various collections of objects,
including such collections as lists, queues, arrays, hash tables, and dictionaries.
System.Data-Includes classes that make up ADO.NET. ADO.NET lets you build data-handling
components that manage data from multiple distributed data sources.
System.Drawing-Provides access to the GDI+ graphics packages that give you access to
drawing methods.
System.IO-Includes types that support synchronous and asynchronous reading from and
writing to both data streams and files.
System.Net-Provides an interface to many of the protocols used on the Internet.
System.Threading-Includes classes and interfaces that enable multithreaded programming.
System.Web-Includes classes and interfaces that support browser/server communication.
Included in this namespace are the HTTPRequest class that provides information about HTTP
requests, the HTTPResponse class that manages HTTP output to the client, and the
HTTPServerUtility class that provides access to server-side utilities and processes. You can
also use cookies, support file transfer, and more with these classes.
System.Web.Services-Includes classes that let you build and use Web services,
programmable entities on Web Server that code can communicate with using standard
Internet protocols.
System.Windows.Forms-Includes classes for creating Windows-based forms that make use
of the user interface controls and other features available in the Windows operating system.
System.Xml-Includes classes that support processing of XML.

The Visual Basic Integrated Development Environment


Microsoft Visual Studio is an Integrated Development Environment (IDE) provided by Microsoft to
create and develop Windows-based, console-based, and mobile based applications for .NET
Framework. It provides various development tools to design and create the applications without
remembering the syntax.

Following are the benefits of using Visual Studio:

1. Helps in minimising the development time


2. Simplifies the process of testing applications
3. Provides different toolsets for integrating graphics designers into overall development
process
4. Support multiple versions of .NET Framework
5. Enhancements in data retrieval and data binding
6. Inspects code to find sections of code that need to be refactored

Prof. Sushant Sundikar VISUAL BASIC.NET


5 Chapter1: Visual Basic .NET and the .NET Framework

7. Provides supports for Web, mobile, client, and Office application development.

Features of Visual Studio.Net


Auto Hide

This is a new feature in Visual Studio that instructs the IDE to "hide away" the windows you
are not currently using. This feature provides a lot more elbowroom for code construction
and other tasks like debugging. When you need them, they're back in a jiffy.

Dockable Windows

You can dock all windows in Visual Studio to any edge of the main IDE window. The Auto
Hide toggle also serves to lock the window in place so you must first un:Auto Hide before
you can move the window. Undocking a window is as simple as yanking the window off the
side of the IDE. You can also double:click the ;tle bar to dock or undock a window once
Auto Hide is off.

IntelliSense
One useful feature of Visual Studio .net IDE is Microsoft IntelleSense. IntelliSense is whats
responsible for those boxes that open as you write you code listing all possible options and
even completing your typing for you.

Find Results

The Find Results windows (primary and secondary ones) display the results for "search and
rescue" operations launched from the sophisticated Find and Replace dialog box. Find and
Replace is accessed from the Edit, Find and Replace menu option. From here you can search
for tokens, symbols, character strings with standard pattern:matching, regular expressions,
and wildcards.

Dynamic Help

Dynamic Help is one of the most useful features of this IDE . Simply place your cursor on an
element of your code (such as a class name or a method) and Dynamic Help finds and
displays a link to the resource in the Visual Studio help system.

Event-Driven Programming
A Windows program is quite different from yesteryears MS-DOS program. A DOS program follows a
relatively strict path from beginning to end. Although this does not necessarily limit the functionality
of the program, it does limit the road the user has to take to get to it. A DOS program is like walking
down a hallway; to get to the end you have to walk down the entire hallway, passing any obstacles
that you may encounter. A DOS program would only let you open certain doors along your stroll.
Windows, on the other hand, opened up the world of event-driven programming. Events in this
context include clicking a button, resizing a window, or changing an entry in a text box. The code
that you write responds to these events. In terms of the hallway analogy: In a Windows program, to
get to the end of the hall you just click the end of the hall. The hallway itself can be ignored. If you

Prof. Sushant Sundikar VISUAL BASIC.NET


6 Chapter1: Visual Basic .NET and the .NET Framework

get to the end and realize that is not where you wanted to be, you can just set off for the new
destination without returning to your starting point. The program reacts to your movements and
takes the necessary actions to complete your desired tasks.

Components of Visual Studio IDE

Menu System
The menu bar of the Visual Studio IDE provides different menus for different menus for
different Visual Studio commands. Most of the menus are displayed as Toolbar.

Toolbars
Toolbars are the shortcuts to the most frequently performed actions. You can find the same
commands that of the menus but these are much faster to access than menus.

Code Editor
The code editor allows you to write and edit code. You can press F7 key to switch from the
Window Designer to the Code Editor. Alternatively, you can switch to the Code Editor by
selecting View  Code. You can use the same type of files, such as text files and XML
documents. Using code editor you can set breakpoints for debugging the application, and
collapse sections of code to increase readability.

Solution Explorer
A Solution is defined as a set of projects that are part of the same application in Visual
Studio. The Solution Explorer displays each project, each projects references and
components. If you wish to activate Solution Explorer in the IDE, click on ViewsSolution
Explorer or press CTRL+ALT+L keys together.
The solution explorer gives you a graphical representation of all the files that make up your
project. When you double click on any file in you project such as a form within the Solution
explorer, it opens the form in Windows Forms Designer.

Object Browser

The Object Browser is one of the most important windows you will access during the lifetime
of a development project. It lets you look at all the classes provided by the .NET Framework
as well as any custom classes and types you are working on. It identifies the various
namespaces and the assemblies within which they are packaged. Further, it reveals the
classes and all their respective members, such as methods, properties, and fields.

Toolbox

The Toolbox contains the components and controls that can be added to Windows Forms
applications and Web Forms applications.

Class View

Prof. Sushant Sundikar VISUAL BASIC.NET


7 Chapter1: Visual Basic .NET and the .NET Framework

The class view contains a hierarchical tree view representation projects at the top-level node
and displays the classes, methods and properties associated with a particular project. It
helps us to find a member of a class that we want to work with.
You can view class view by clicking View Class View or by pressing CTRL+SHIFT+C keys
together.

Properties Window

As the name suggests, the Properties window in Visual Studio is used to set the properties
for various objects at design time. You can view and edit the properties of a file, folder,
project or solution using the Properties window and can modify properties of the
components of projects and solutions.

To view the Properties window, click on View  Properties window in the menu bar or press
F4 key.

Server Explorer

The Server Explorer window lets you access server:side resources, such as databases, email
servers, event logs, and message queues.

Macro Explorer

Macros let you customize the IDE in ways that cater to your programming habits, style, and
comfort. Macros and the Macro Editor are new to Visual Studio and give you more control
over the IDE than the Tools/Options facility. The entire IDE is customizable through macros.

Task List

Once you become productive, the Task List will be another indispensable tool. This utility
helps you manage tasks within the solution; but most importantly, it displays the
compile:;me errors and their causes.

Command Window

The Command Window is another imperative feature of the new Visual Studio .NET IDE. The
Command Window has two views, Command and Immediate.

Command Mode Lets you execute Visual Studio Commands without using the IDE menu
system.

Immediate Mode Used for debugging, expression evaluation, and variable modification.

Output Window

The Output Window displays build/compiler or diagnostic information depending on the


mode it is in. During a build of a project or solution, the window is used to communicate

Prof. Sushant Sundikar VISUAL BASIC.NET


8 Chapter1: Visual Basic .NET and the .NET Framework

build and compile information. In Debug mode, during processing, the Output Window
displays libraries loaded, return codes, and various details being emitted from running code.

QUESTIONS:
1. What is .net?
2. Define the following terms: MSIL, CLR, and FCL.
3. Explain the .net framework architecture.
4. What are the design features of .net framework?
5. Write down the benefits of using Visual Studio.
6. Explain various features of Visual Studio.net
7. What is event driven programming language? How is it different from traditional
programming?
8. Explain in brief different components of Visual Studio IDE
9. Write short notes on : a. CLR b. FCL

Practical Assignments
1. Create a visual basic project (i.e., Console Application) by name MyFirstVBApp and then
write down the steps to do the above.
2. Write a VB.net program to display a Hello World message and then execute it in VS.NET
IDE.
3. Close all the component windows (for ex: Solution Explorer) and then try to get them back.

Prof. Sushant Sundikar VISUAL BASIC.NET

Вам также может понравиться