0% found this document useful (0 votes)
13 views

chap 1

.NET Framework is a software development platform created by Microsoft in 2002, enabling the creation of applications using various programming languages. It consists of key components such as the Common Language Runtime (CLR) for executing applications, and the .NET Framework Class Library (FCL) that provides reusable code. The CLR manages memory, handles exceptions, and ensures interoperability among different languages through features like the Common Type System (CTS) and Common Language Specification (CLS).

Uploaded by

Arshdeep Kaur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

chap 1

.NET Framework is a software development platform created by Microsoft in 2002, enabling the creation of applications using various programming languages. It consists of key components such as the Common Language Runtime (CLR) for executing applications, and the .NET Framework Class Library (FCL) that provides reusable code. The CLR manages memory, handles exceptions, and ensures interoperability among different languages through features like the Common Type System (CTS) and Common Language Specification (CLS).

Uploaded by

Arshdeep Kaur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

l lfJ

T h e .NET F ra OUerview of Vis


m e w o rk p ro v 11a[ St'%
u si n g differe id e s a c o m m
I, W h" h allow ndtevla n g u a g e s of .NET e n v ir o n ~o n p la tf o rm to w ri te p o rt a b le s
lC ic e s se rv ic e s e n t, b a s e d ~ Pro " '
d is p e rs e d n e ' a n d a p p li c a ti n o p e n In te
tw o rk o f n e tw o n s to w o rk ~ rn e t Stax-i_~,
a p p li c a ti o n s, o rk s. It is u o g e th e r a c ro
w e b _a p p li c a ti s e ~ to c re a te c o 1 s s a ,,.;1 (i~ n.
n s o e a p p li·c
ons and web a ti o n s , ••Wc\ine.(i~'I\
m INTRODUCT
ION T O .NET FRAM
sel"Vlces. . ~
1:1~~
T h e .NET F ra EWORK F1
m e w o rk is a
2 0 0 2 b y Mic d e v e lo p m e n t s<
rosoft. It s u p p la tf o !m w h o
se rv ic e s. It is p o rt s Jgcl.s a s e fi rs t v e rs io t1
c o n s id e re d a n d te c h n o lo g n w a s rele
li k e C o ~ n n e n g in e for p ie s fo r p ro v 11
ro v id in g ru n ti id in g in fr a s t as
Langpage ~ m e s e rv i_c e s e(i il\ i:
h e lp s in w ri ti me (~LR)_ u s in g i
n g m u lt i-p la tf a n d .-~ E T F ra ts~
VC++ e tc . T h o rm a p p h c a tl m e w o r~ C la (

e s e... la n g u a g e o n s u s in g la n ~ s L ib ra ry ~ ~ e nt~
o ri e n te d p a ra s a re c a ll e d
. E T c o m li a n t
a g e s h k e V is
u a l B a s ic L). lt
'0
d ig m . All th e la n g u a g e a
c o m m u n ic a te s e la n g u a g e s n d
w it h e a c h o th a re a b le to· a c c e s u p p o ~C# _anu
P ro g ra m s w ri e r. T h e re is n s s t e fr a m e
tt e n u s in g .N o .NET la n g u a g w o rk a s obJeq_
ET c o m p li a n e w it h o u t th
d e a li n g w it h
th e ?s_ it se lf i F ig u re t la n g ua g e s d
1''7. ·s h o w s t~ e e a l w it h .NE
e
T
.N
c
E
o
T F r Well a~
d e _amework.
a rc h it e c_tu re
o f .N E T Fram
ew:-~~ead Qf
Figu re 1.1: Archite
cture of .NET
Framework

\V B \ \c++\ ~ \ JScript \ \ M a n y m o re
.... \
Languages

S u pp ort ~
.NET F ra m e w
o rk C la s s L ib ra ry
fo r A p p li c a ti o
COMMON LA n s lFCL)
NGUAGE RUN
TIME (CLR)
\
\c T s \ \c L s \
\ J IT \ \ GC \
\M e ta d a ta\ \A
s s e m b li e s \

Runs on

O p e ra ti n g S y
s te m

T h e m a in c o
m p o n e n ts of
.NET F ra mew
► Co m m o o rk a re :
n L a n g u a ge
R u n ti me (CLR
► .NET F ra )
m e w o rk C la s
s L ib ra ry (FC
L)
overview of Visual Stiwio .NET IIJ
ill~ Common Language Runtime (~LR)
' Common Language Runtime (CLR) is the !virtual machine componeny of .NET
Framew~. It provides runtime environment for all types of .NET applications. The
source code of applicatidns de ~ ed usmg .r{ET compliant languages is c-0mpiled by
that language's compiler ~r:_to ~tgi_intermediate Jan~age ~alf_:3
_MSI~ (Microso_ft
Intermediate Language) or In·erme 1a e an.cc . . .,co.cc-. . 1: c0ctet!Y"platform
independent. It is comparable to byt~code in Java. Metadata is also g~nerated 'durjng
compilation along with MSIL code and is stored· in a file kri wn as Manifest fi . This
i ~ etadata }J generally about.members, types which are require y CLF for execution.,of
MSIL code. A Just-in-Time (JIT) compil~inporient'-of CLR converts MSIL code intQ
native code of t:1e machine. ~his code is platform dep~f CLR manag~s me~ory,
threads, exception&..-.c_o de-exe@tion, c o ~, verillcation and compilation . Figure '
1.2 shows the conversion of source code mto native code.- - -
Figure 1.2: Converting Source Code Into Native Code.

Source Code .NET


~
MSIL & Meta .-
-~ - Native
CLR
(.Net Language Data (Portable (JrT) C(?de
Technologies)' Compiler. Executable
File).

~
The main components of CLR are: ~ C/ L)
, Common type System(CTS)
, Common Language Specification(CLS) /
, Garbage Collector(GC) .../
, Just in Time Compiler (JIT)
, Metadata and Assemblies ./
r
(i) Common Type System (CTS): Common Type System (CTS) provides
I _.. •
guidelines for decl~uing,_using and managing data types at runtime .. It offers
cross-language communication. For exampll (VB.Nlfr has 'Integer' data type
and C# has 'int' data type for managing integers. After compil~tion, 'lnt,32: is
used by~both d~ typ,Vo, CTS provides the data typ: s used by managed
code (code compiled using the .. NET Framework). Cbmmon Type System helps
in writing language-independent code. It provides two categories of Types.
• Value Type: A Value Type sto_res the data in memory allocated on the
stack or inline in a structure. This category of Type holds the data directly.
If value of one varia_~ ~ - ~.Qpied to Qffiyr, both tp_e__~ab~e~ st.9re data
independeney. It can be of built-in types, user-defined or enumeration
types. Built-in types are primitive data types like numeric, b_o olean, _Ehar

-
and date. User-definecf types are created by users in the source code. An
enumeration refers to set of enumerated values which are represented by
labels but sto:r:ed as a numeric type.

• • Reference Type: A Reference Type stores a reference to the value's


memory address and is allocated on. the heap. Heap memory is used for
Overview of Visual Stiwio -NET

dynamic memory aHocation. Reference Type does not hold actual data
directly but h-elds - address ·of data. Whenever a copy_ Qf _Refe~enc~ ! YJ?e
object is made, it copies addre-ss and not actual data. Therefore two
variables/ obje~ts will refer to same data. ff data of one Reference Type
object is changed, · the same· is reflect'ed for the other obje~t. Reference
Types can be self:-desctibing types, pointer 'types or interface types. The
self-describing types may be strin&__fil.ray and class types which store
metadata about themselves. .. . ... ---
'
The Figure 1.3 shows the difference between Value Type and Reference
Type.

Figure 1.3: Value Type and Reference Type

I
VB. Net Statement&- .. --r r.
Dim cnt as Integer = 4 ~ ---- •·· .... ~
Dim tmp as Integer= 30 , - ~ .... . ,:J. Value e
Dim langname as String= VB.Net'
I
--
,, - - - - - - - - - - _.._ - - - - - - - - -- -·- ....
,------ --- -- - --,
I STACK
~--------, /I
I
HEAP
\
I
I
cnt 4
II ~ - - ----,
II
1
I VB.Net '
I
tmp 30 I
I I
I I
langname String Refere~ce I I
I
f I i
\. _________________ ~ _______ .,../ I
\ - ---~-- - - - - - - _..✓
/

Reference Type

(ii) Common Language Specification (CLS): Common Language Specification


(CLS) contains a set of rules to be' followed by .all .NET ·supported languages.
The set of common rules make it easy to implement language integration anC-
help in cross language inheritaD,ce and dequggi_Eg. Each language supported ·
by .NET Framework hfl.s its own syntax ru~es :'"i3ut CLS ensures interoperapility
among applications developed using .NET languages.
(iii) Garbage Collection: Garbage Collector is a component of CLR which works as
Lauto~~tic~ mory !11~ It helps in ~anaging memory by automatically
alloca mg and deallocating memory according to the requirement. It allocates
heap memory to objects~hen objects are not in use, it reclaims the memory
allocated to them for future use._ It also ensures safety of objects by not
allowing one object to use the content of another object.
(iv) Just in Time (JIT) Compiler: JIT Compiler is an important component of

J
OVeruiew of Visual Stiroio .NET
CLR. It converts the MSIL code into native code (i.e. machine specific code).
The . .NET program i~ c~rppfled either explicitly or implicitly. In explicit
compilation, developer or· progi:~mer calls.a .part .Jf.µl~ mpiler to compile
the · program. In implicit co11?,pi!a_ti~I), the~ program is compilecj. twice. The
source code is compiled· into Microsoft Intermediate Language (MSIL} during
-- first compilation' process. In I se~~md compilation pro~ess, the MSIL code is
converted into native code: This process is.called JIT compilation.. There are
three . types of JIT compilers \ -Pre Econ and ,....Norm;}) Pre JIT iJer
comp1 es en ire code into native code befor execution. ono JIT
Compiler compiles only those parts of MSIL code which are re wred duong
executio~ and remove those parts which are _not _ITquired @ Y mo~ No al
JIT Compiler also compiles only those parts of MSIL code which are require
during execution, but places them in cache for future use. It does not require
recompilations of already used parts as they_ have _b_ee!} _elaced in cache
memory-:- ·
(v) Metadata and Assemblies: Metadata is Tbinarv informatiod about the
program, which is either stored in a CLR Portable Executable file (PE) along
with MSIL code or in the memoty. During execution of M$IL, metadata is also
loaded into memory for proper interpretation of cla§_s_es_ an<L._r~lated
information used in code.So, metad~t~ is nelpful in ~femei).ting code in
language-neutral mannel'orin achieving language interoperability.
- --~. - . . - - - -·- ~

sembl is a fundamental unit of physical code groupin t consists of th e


assembly manifest, metad~ta, MSIL code and -a se o resources like image
files. It "is also considered as a basic hnit of de2~ ent, version control, reu se,

-
security permissions anci~ any in-ore~ -- - - ~ ----- -
When an application developed using .NET framework language is executed , it
creates one or mor~ assemblies which are run by CLR. CLR needs version and
_./

permissions information alon~ wi! 1rj fi:e ~~-!~ ,Eo~~ So~ ~ e!!}hly ..also
includes manifest. An ! ss~bly mapifegju;.o..mmhl_Llo_ a table _of contents
having nameaiid version of the assembly. The manifest also includes list of
other assemblies to be used by the current assembly and security information
to manage security issues. An assembly also includes modules. Each module
is an internal file havin·g ready to execute MSIL code. So, each module
contains types i.e. classes and interfaces used in the corresponding source
I
I\ code. Assembly also includes information about how its various modules
interact with each other. So, an assembly is complete unit of information that
CLR is able to execute.

1. 1.2 .NET Framework Class Library (FCL)


The .NET Framework Class Library (FCL) is the second E.1-ajor component of the
.NET Framework. It is integrated with the GLR of the Framework t<!_~anage the code
execution. The FCL is comparable to Java Foundation Classes. This library contains
overview of Visual Stubio .NET
num ero us pre -wr itte n and reu sab le
typ es suc h as cla sse s, inte rfa ces , stru
enu me rate d val ues , wh ich are collecti ctu res and
vely call e~ typ es i~\.N~Tf ram ew ork
gro upe d into esp ace s o tha t the y can be acc ess ed .µ!;__§71:._e_ s arfil
be use d in a 1ca ons a evelo ped eas ily. The se n~ esp ace s can
usi ng Vis ual Bas ic, C#, C++, JSc
example, the .NET Fra me wo rk def ine npt etc . For
s the For m cla ss in the Sys tem . Wi
nam esp ace for cre atin g forms. So it b~c ndo ws. For ms
omes eas y to wrj te pro gra ms . It is als
to mix lan gua ges even in •the sam e o pos sib le
app lica tion s as all lan gua ges wh ich
Visual S.tu-dio use .the sam e .NET FFa are par t of
. - - mework cla ss libr'ary.
IL.expedites and ·optimizes the dev elo
pm ent pro ces s of an ~pp lica tion by reu
cla sse s and inte rfac es. Developers sho sin g the
a sp._ecific functionality . FCL can be a
uld kho w the ·role- of specific cla ss
in pro vid ing
use d con sist ent ly by all the .NET lan
developing ma ny typ es of app lica tion gua ges for
s wh ich are list ed as follows.
,. C5msole Applications run in a DO
S com ma nd window and . pro vid e Ch
Use r Int erf £e (ClTI). ara cte r
,. Windows For ms con tain s Gra phi cal
use r Interface (GUI) for win dow app lica
wh ich are usu ally local to one 's ma chi tion s
ne.
,. We~ Applications are developed
usi ng,.+A
.._ S_P_.@
_E_T___ The se app lica tion s run on a
web server and inte rac t wit h the use r
thro ugh a web bro wse r.
, ~ .NET J s the technology use d for wor
king wit h dat a and dat aba ses . It
provides acc ess to dat a sou rce s like
SQL Server, OLE DB , XML etc .
retrieving, ma nip ula ting and upd atin g for
dat a.
,. ~ ·e s are softwar-e com pon ent s tha t use
a sta nda rdi zed XML me ssa gin g
sys tem and are acc ess ed thro ugh Inte
rne t.
,. Mobile Applications are app s design
ed to run on a mobile device.
, AJAX (~s ync hro nou s Jav aSc ript
and XML) is an e ten sio n of ASP.N
developing and imp lem ent ing AJAX fun ET for
ctionality. A P.NET J AX con tain s
com pon ent s tha t allow the developer the
complete reload of the page. to upd ate da o a we bsi te wit hou t a
,. Windows Workflow Fou nda tion
a r r · w·md (WF) hel ps in bu' ld' kfl
PP ica ion s m ows. It con tain s activities workfl1 mg wo r ow -ba sed
designer and a rule s engine. •
' ow run tim e, workflow
,- Windows Pre sen tati on Fou nda tion
interface and the bus ine ss logic pro vid es a .
It h 1 . sep ara tion bet we en the use r
doc um ent s, media, two and thr ee d.'
. . e pals m d~v elo pin g inte rfa ces usi
ng
,. Wmdows Com mu nic atio n Fou nda ime nsi on gra phi cs ani ma f
tion (WCF . , 10ns etc .
and exe cut ing con nec ted sys tem s.
) is a tec hno log y use d for bui ldin g
,. Windows Car dSp ace provides
. fi . saf ty ~ .
per son al m orm atio n on the Inte rne t.e 1or acc ess ing
.
res our ces and sha rm g
,,, Lan gua ge Int egr ate d Qu ery (LIN
Q) imp arts d .
lan gua ges usi ng a syn tax wh ich is
sim ilar t a~ que ryi ng cap abi liti es
SQL. to .NET
o t e con ven tion al que ry lan gua ge
overview of Visual Stiroio .NET

IE MANAGED AND UNMANAGED CODE .


The .NET Framework supports two types of coding, Managed Code and Unmanaged
Code. Figure 1.4 shows the execution of both managed and unmanaged Codes.
, Managed Code: The code -created by c~mpile~ of any of the .NE1' Framework
language_s is called managed code. It is in Intermediate Language (IL), s o ~
be run directly on a machine, but runs under the control of CLR. It is kept
file called an assembly along with •metadata which /describes the classes,
methods and attributes of the code. CLR also p_5rlo rms various 3,5ks like
memory management, security enforcement, debugging etc. for managed code,
but does not allow the low-level access of the CPU architecture.
/

,, U~man~ged Code'. The code developed ~-qtsi~e .NET Framework and compiled
directly mto machme language is called/unmanaged code. S_uch code fioes not]
run under the control of the GLR, but runs under proces~ of Operating system.
For example, code written in C++. for accessmg low level functions of the
operating system. The .NET Fr~~work does not provide direct backward
compatibility to code written using older versions of languages like VB, C++, but
through unmanaged code.

Figure 1.4: Execution of Managed and Unmanaged Code

Source Code ( •• .. .. • t

· • Others

Managed Code Unmanaged Code

Code Assembly Executable

Common Language Runtime

Operating System

IIJ ADVANTAGES AND DISADVANTAGES OF .NET FRAMEWORK


The .NET Framework provides the following advantages.
(i} Object Oriented: The .NET Framework supports object oriented programming
paradigm in which user can work with different languages like C#, VB.NET for
writing console , event-driven Window and Web based applications. ~

~
r-m overview of Visua( Stiwio.Nl:.l'
(ii) Cros s Language Interoperability: The .Net
Fram ewo rk prov ides supp ort
. fo~ ss lang uage inte roperat:nficy whic h impl ies code
writ ten in one language
can be used by anot her lang uage . For exam ple, code
writ ten in VB.NET can be
used .with the mod ules developed in C#.NET.
(i!j;) Developer Productivity: Due to cros s lang uage inter
oper abili ty, developer
can us.e . any._ .NET .language of his choice for
deve lopm ent, whic h in turn
incr ease s pro.ductiyi_ty ,__ Mon ~ov~r, __n:umerous ..in.,b
uilt ..clas ses- and . reus ing of
existing class es mak e the application development
easy. For exam ple, Visual
Basi c is referred as RAD lang uage whe re RAD
stan ds for Rapid Application
Development.
I "1lvj Performance: Its CLR environment promotes
safe exec ution of co~ ,
eliminate ~.per:_f_<:> rman ce bottl en~ ~ ~~rough ~!~
~~~~ r, min~m~es
\ sof~ are developm ent con'Ilicts thro ugh n0-!!!~§Qa<;_~~
conflicts thro ugh assembly manifest. ·
~~ p- , . . . . r ~
l:!.V01ds verSJomn g

(v) Multiple App licat ion Deve lopm ent: It prov


ides cons isten t experience for both
developers and user s acro ss various types of Win
dows-based and Web -bas ed
applications on multiple devices.
(vi) Secu rity: The .NET Framework provides
code acce ss secu rity thro ugh
assemblies.
(vii) Code Rob ustn ess: The code robu stne ss is
achieved thro ugh Com mon Type
System (CTS), which provides strict type-and-cod
e-verification . The CTS
ensu res that all man aged code is self-descriptive.
The vario us Microsoft and
third -part y language compilers generate managed
code that conf orms to the
CTS.
(viii) Backward Compatibility: The runti me
envi ronm ent offers back ward
compatibility by supp ortin g software developed usin
g older vers ions .
(ix} Huge Library of Code:_The .NET Framewor
k provides huge libra ry of code s to
be reus ed by .NEi: compliant languages.
'
(x) Intellisenae: Visual Studio .NET IDE supp orts 'Inte
llisense' featu re that helps
in automatic code completion. It helps in redu cing
typo efforts and mist akes .
1
Though the .NET Framework provides man y
adva ntag es, it has certa in
disad vant ages also. The disadvantages are:
(1). Managed code may be slower than native code
. -----------
. ./
(ii) Migration of applications to .NET Framework c~
be expensive. ,
(iii) The .NET Framework is prop ~eta ry ~oftware ·
·~ ovid ed by Microsoft. It il}Y_olves
the dang er of vendor lock-1µ which implies t
t f t
depe nden t on the prod uct and servi.ces provided ~ u ure d eve1opm - ·
ent 1s
(by the vend or.

IIJ INTRODUCTION TO VISUAL STUDIO .NET


Visu al Stud io .NET (VS.NET) is an Integ rated Deve
lopment Env iron men t (IDE) for
- overview of yisual Stumo-.NB(l'
.NET Framework. During installation of VS.NET, .NET Framework is installed first and
then VS.NET is installed. Visual Studio 2015 was introduced by Mi crosoft in 2015 . It
supports Programming languages such as VB .NET, C#, VC++ , F# , JavaScript, Python
etc. Microsoft has added many new features for building mobile applications.
(i) Visual Studio Express: Express edition is free for everyone. But it provides
limited features which are capable of fulfill-ing only the basic needs of software
build up; -Express editions started with Visual Studio 2005.
(ii) Visual Studio Professional: Professional edition of Visual studio is for
development by individuals. This edition is reasonable-in price too.
(iii) Visual Studio Premium: Premium edition is used by people who make high·
quality usage of the IDE. It includes advance tools for planning, developl_ng,
testing, code analysis and debugging fo; development teams·.- - -
-
(iv) Visual Studio Ultimate: This is the ultimate edition of the product with all the
components that could exist within Visuctl Studio. This edition provides
advanced debugging capabilities with all architecture and modeling tools .

• INSTALLING AND STARTING VISUAL STUDIO


Many versions of Visual Studio are available in the market. The contents of th is
book are based on Visual Studio 2015 Professional. The steps to install Visual Studio
2015 are described as given below.
, Double click on the executable file, vs_professional.exe. It starts installing
Visual Studio. It shows starting screen as shown in Figure 1.5.
Figure 1.5: Starting Screen

Configuring teed...
'· .

► Select location and type of installation (Default) and then click on 'Install'
button. It will prompt for confirmation . Click on 'Yes' button as shown in Figure
1.6.
- Figure 1.6: Choosing Location and Installation Type

► It take s time to install. So, wait until next mes sage


com es. Duri ng insta llati on,
the following ·scre en will appe ar as shown in Figure
1.7.
Figure 1.7: Acquiring and Applying Visual Studio Resou
rces

► After succ essf ul insta llati on , the mes sage


'Setu p Com t d' . Click
on butt on 'Lau nch' as show n in Figure 1.8. 1
p e e will appe ar.
OVeruiew of Visual Stu3io .NET 1111
Figure 1.8: Completing Vlaual Studio Setup

► First time when Visual Studio is launched, it prompts user to sign in to VisuaJ
Studio. For signing, click on link - 'Sign in', otherwise click on the li nk • 'Not
now, may be later' as shown in Figure 1.9.

Figure 1.9: Signing In

.I
c<i Visual Studio I
W el_c orne. Sign in 10 Visua l Studro.
V,\u,11 ~\ol'Ci•o ~.. ,u ~t,11n.,1,,.-t!-. l , ~ ~e-- t-;,rf"d ,'\ \,-. , .....
:rt"11n1~ t ~<1"1'1 :lr-·,,e--_ ~,.;t cc1v•~ C1 ~.: .:,,,h""C ck-,4. :,:,e, "" .._,_..,,

► Wait for Visual Studio to start as it takes a few minutes as sho\vn


1.10.
iltl
1

OVerview of-visual Stub;o

Figure 1.10: 'Flrat UN' Screen

0-0 Visual Studio I

W e' r e pr e:tparirty fo r fir s t u s e I

1'

► Next, a start page of Visual Studio will appear as shown in Figure 1. 11 .

Figure 1.11: Start Page of Visual Studio


o4 -'•·- Y'GW!Shdo
~• £"' :r- l1rbo1 ,...,,, r-
e - ~ tJ' ► Atttch_ ..

Discover what's new in Professiona l 2015


Visual Studio l-:o1:,..abcutnc....fe.: ...::c,n0~ ~1:;:>1:,
~ .,. I\.!: 1 ro~ ,..., m e .Ncl '",,...,,~
[a,.lf::, l'ohils,.n-. &...,\'tkl.tfScocii-, ~

Stan

R~ 1.0 Cloud· ptr~ )', : , u , ~1


Os:-< i-,o+rt New on Microsoft Platforms
Con nect to Azure E)
=. . C"I~":

.,,:, M<1cwl1 4,:u,e


N :.s;i,;n !:,r,:1 Nt:e
News f] M~o:,,,'1 CH<.e

Wt •n urwbk to d ~ <ont«nl: M to netf1¥'01tt eswe.


a S."IJ'ePC•f'lt 0 ~.-d~pft'ttftt

Featured Videos
We 1 rt: urwbk 10 d owN01d conlr.nl due l o n~ wori: tau~ .

c, Sn1pP"'9TOOI
kt:cp P•9t' opt11 1ffe, ptOJffi
lc1d1
✓ She. p11 , on "1•,tup

► Now an applica tion can be d evelope d using Visual Studio. The Start Page of IDE
consist s majorly of the followin g options .
(iJ The New Project : This helps in creatin g new project s. Various
applica tions can be built using differen t program ming languag es __like
Visual Basic, Visual C#, Visual C++, Visual F#, JavaSc ript, Python etc.
(HJ The Open Project s: This shows a lis t of recently create d/used projects .
For openin g an exis ting project, Click on Open Pr ojects.
(iii} News: This section provide s latest online news, announ ces new release s.
and update s.
overviewof Visual Stumo .NET

ID VISUAL STUDIO .NET IDE


Visual Studio JE! egr~ Dev~lopment Envir~nme® I ) is a set of ~f~are
development tools for building GUI and writing code fo · erent types of appbcaoo ns
using _mi~imal time and effo~ Jt provides~ ool Box.JJ e_ource-Code ~_Iy>r, ~ebu~~ •
Com. 1lat10 '. frogram execution environmen.) and ,many more opt.Jons. When Visu_al
tud10 IDE· 1s started, click New PrnJect opbon and a _dialog box appears as shown_tn
Figure 1.12. When IDE is· opened first time or a new project is chosen, a new soluOQ.T1
is created by default. · -

Figure 1.12: Choosing New Project In Visual Studio


X
New Projtct

~ Recent Sutchi nsullcd Temp(,!e ICtt'• f P·


• Instilled ,..,
L.J Wind<>ws Form, Appli<1tion Visual Basic
Type: Visual Basic

• Templates A project for u ..t,ng ,n 11ppliu1>0n ..ch•


r-VI
Windows use.r inteiact
• Vrsual Basic WPF Application V,sual llasoc
41)J
~~
Web
Cloud
Ii Console Application V,sual 8asic

~,~·.
,-v■
Elltensibility Shared Projtct Visual Basic
lightSwitch
IE'lj
Offic<!SNrePoint (l~VI Class Libra,y Visual Basic
Stlvtrlight
Test Clm Libra,y (Portable) VLSual Basic
WCF
Woritflow
~ Typexript
t Other Languages
t Other Projtct Types

Samples

~ Online

Click here to go online and find templ,tes.

.---~
OK II C.ncd :

F~llow the steps given below 8:!'t er Clicking on New Project option.
- ·--- -----
.. _
(i) Select Visual-Basic from Templates (First Pane)

-
(ii) Select Windows (First Pane)
(iii) Select Wirldows Forms Application (Middle Pane)
(iv) Type the name of project as FirstWindowApp (Bottom Pane)
(v) Click OK button.
After creating a new solution in previous step, Visual Basic.NET IDE appears as

-
shown in Figure 1.13. The Title bar indicates the name of solution specified ir1 the
previous step. This screen displays Form window, Solution Explorer wirldow and
Property window besides many other menus, tabs and windows. Developer can now
start designirlg of GUI to develop applications using Visual Studio .NET.
f

ml overview of VisNal StMbj0 -N1rr

Figure 1.13: First Screen after creating a new Solution in Visual Studio 2015
DiQ r w a ~ • Mtc1e1oft VllualS1Wio
[~t io• Y•- e~JKI 11'-"d Qtbug Tum F~INI Iocff ~T111 - ~IJ'l!. , 'P':'6°"' . ~P_____ _.. _
C • ,1 ~ • ~ Iii ~ t \ '} • 1' • Otbu~ • /1..,., CDlJ • · ► StMI • 1 • ! ~ /f :
: Form I ,·b IOwgnl "' l(

IF=-
~ , , ,.,., • r
I> ,
B ,.,.___,
; Myolro,e~
t • • P.dtnnee
.,: , i.~.n rl-9
I> £:i h,mi l....ti

r- 1 !r,'flan.Wr.OOw"JO/fff'rU'Otffi

I,,,
:!! ~•_.!?.. f
R.rloldt1. ~-o..e ,...
~ !ton ,-
131c,
Sho,,,ffli ~t
'~
)IXl;.:.o
Sc,Gnpl<yl,
StJ:ftFO$.CJ(ln
"""'
~Jl,llttoc~
1,.
Tm ,-,
,.,,.
TOf1M011
1,..,
lht l c.olH!.0<,.lf'd••·•tt1lh<l! CCfClol

Q T~ her~ to Y-arc.h 0

The Visual Studio IDE includes various windows. The main windows of IDE
are described as follows.
(i) Form/Design Window: On creating a new project, a Form is displayed in
middle pane as shown in Figure 1.13. '-3 Form is also considered a
control by itself. It has 'Forml' written in its Title Bar. The default
Form is an object and an instance of the System.Windows.Forms.Form
class of System names ace. Click anywhere in the Form's empty space,
then Form l's r roperty window hows its properti@like Name, Text, Size,
Font, Location, oreground coloF, background color, MaximizeBox,
MinimizeBox etc. These properties can be changed by typing a value or
selecting a value from a drop-down list. The title of the Form is defined
by the Text property and its default value is Form 1. To change the
Form's title, click in the box on the right of the Text property and type
text. Title always appears in the- title bar of Form window. 'Forml ' is also
used as the default name for the Form and it· can be changed by
changing its Name property. The current Form is represented by the
name 'Me' in coding. For example,
Me.Text="Sample Title of Form"
-'
(ii) Toolbox:[oolbox acts as a palette) It contains many controls that~ be-
placed in Visual Studio forms for designing Graphical User Interfac/ /
Controls are categorized further into ten different categories such as AH ,
Wi~dows Forms, Co~ mon CQ.ntrols, Containers, Menus & toolbars, Data,
Components, Printing, Dialogs -'and W'PF!nteroperability and Gerier'al.
r-- .--- ..-- .
_)
overoiew of Visual Stiwio .mr

Generally, Toolbox is shown on the left side of Visual Studio IDE. The
developer can drag a control from Toolbox and drop it on the already
open FormJTo see the commonly used controls, click on 'All Windows
Forms'. The partial list of controls is shown in the left pane of Figure
1.14.

Figure 1.14: Ust of Controls In 'All Windows Forms' Group

D4 WindowsAppliutionl • Microsoft Visual Studio


file Edit l£iew frojw lluild .Qebug Tum Jools T~ Aaofyze Ylrnd- fldp
'i O • 'C> I C· "1 11 # I j " I ? • ~ · ,-fi ~"!. -·-. ~ :_PU _ • ► Start

Forml vb (Oosign] ~ X ·
- ----- ·-- • q X
p .
,. All Windowt. Forms ... •9 Forml
'" Pointer ; I

if' 81ckgroundWorkor f
~• BmdingNavigator
iil BindmgSource
Iii! Button
liZ] ChockBo,
I: Check<dlrstBox
{i,:', ColorDialog
~ ComboBo,
0 ContO't.MenuStrip
~ D,t,GridView

OateT,mePiclcer

(ill, Propertie1 Window: It displays all the properties and their current
settings related to the selected control. The properties window comprises
Object drop-down list, List of properties and the Bottom section.
► Object drop-down Lilt: In the properties window, the item that
appears at the top part of the property window is the control currently

► --
selected. -
Li1t of Propertie1: It describes property name in left column and its
present state in right column. Every time a user selects a control
either from the Form or from Object drop-down list, its corresponding
properties are shown in the window. State of any property can be
changed either at design time or run time. Change the properties of
the Form at run time by writing the . relevant code. For example, the
property of the object ·can be defined by writing the object's name
followed by a dot and property name.
Me.Text="Sample Title of Form"
Me.MaximizeBox=False
Me.MinimizeBox=False
/D :,. The Bottom Section: It shows a description of the selected property.
~ Solution Explorer: 1Solution r provides an organized view f
. / r ]Tim:!8:eicrte
solutions, projects an 1les. t 1s a p ace o er for coir.n~e:]or:
projects and their build or configuration settings. A project is always
OVeroiew of Vwu,l Stltbfo Jilt
Ill
included within a solution. When a new project is created, Visual Stllcti0
creates a solution by default, name as 'WindowsApplication 1' and so
- --- - , on
until the user changes the default name to some otlier name. Solution
name is also shown in the title bar .of Visual Studio IDE. By default, names
of solution and project are same which can be changed and given different
names. Eachproje~t holds the code ~an~ data related ·to a V!sual, Studio
application. More..than one pro}ect caifbe c~ea,ted undeia solutionz ""
Visual ~tudio uses tw~ file typ~~~~4-
.S~f!] for. storing set~ngs related
to solutions: A text file having extension .slrr-aescnbes a solut?on. It.has a
unique format and it is edited by the system automatically. Another1tle
with extension .suo stands for Solution User Options. It is a binary file. It
stor~s user-\evel customized settings like li'st of files op e last
usage of solution or the location ·of breakpoints etc. It is a hidden fi - and
can be seen only if 'show· hidden files' option is enabled for Window
explorer. A project is saved with extension .vbproj .r ·
To access Solution Explorer, select Solution Explorer on the View menu. It
looks like as shown in Figure 1.15.

Figure 1.15: Solution Explorer


~olutaon Explorer · - r;, X

~- ~ c;.<t I T(9 - !+ <~ >J---:1


e · ~ - I® I ~ .
S e a rc h So lu t i on Exp lo r e r ( C t rl • ; ) P •
~ WinllowsApplicat.ion1 . , .
.J" My Project
I> • ·• R~erences
y:::J App.config
I> ~ Forml .vb

(v) Data Source: Data Source is used to show the available database
connections. (Database connections as covered later in this book).
(vi) Code Window: The Code Window is used to write, display and edit code
related to a Form. The code window appears either by double-clicking on
any part of the form or selecting 'View code' by right clicking on the
Form. Alternatively, function ~ an be used to bring the code
definition window and press 'S~ to get design wincfow of Form. By
defa:ttlt, the Code window shows the structure of a class 'Form 1', default
name of Form. A class starts with 'Public class' and ends with 'End
Class' keywords.
Public Class Forml
Private Sub Form l_Load(sender As Object, e As EventArgs) Handles
MyBase.Load

End Sub
End Class
If we get this window b double clicking on any part of the form , it also
includes default event procedure f Form named as Form_Load. An event
-
procedure ~starts wit . 'Private Sub' c!Ild ends with 'End Sub' keywords . The
'Forml' class and the event 'Load' are joined together- with an underscore to
make Forml_Load. Here, it is doing nothing other than loading an empty form .
In the arguments of 'Form_Load' proc~dure, 'Sender' and 'e' are parameters of
event handlers where~ inforiIDttttm aboutthe object which
generated the event and 'e' is the event itse·lf. The code window includes three
drop down l~sts for listing projects, objects of selected controls and events
related to selected object as slio~ in Figure r. 16. '
Figure 1.18: Code Window

Form1.vb* -ll X
~ WindowsApprication1
S Public Class .?~
l Private Sub Forml_Load(s~nder As Object, e As EventArgs ) Handles MyBase.Load

, End Sub
1 End Class

Each window in VS.NET has three icons on its right side-Window Position, Auto
Hide (thumb tack) and .Close as shown in Figure 1.17.
Figure 1.17: Icon• on tht right of a Window

Window Position has five options. These are given as follows:


(i) Float: When float is selected, the window can be set anywhere. Position can
also be selected as shown in Figure 1.18. Floating windows are always on the
top of other windows. Here, Solution Explorer window is set to Float.
(ii) Dock as Tabbed Document: If Dock as Tabbed Document is selected, the
window is shifted to Tabbed Document area as shown in Figure 1.19. Here,
Solution Explorer window is set to Dock as Tabbed Document.
OVeruiew ~ Viswa( Stllbic, ~

Figure 1.18: Window Position: Float

.
,--------
' l\ · -

S.U-, u,,lo,,, •O l(

llt Q 't• ~G llt I'

} "'1,..,.a

Different screen .~,-~


> u U.,e,ca
D~

positions-to set
windows

Figure 1.19: Window Po1ltlon: Dock II Tabbed Document

c,G WindowsAppli_c~tion1 - MicrosoftVisual,Studio·: .


file f,dit ~tew £roj'ect ,E!uild Qebug Team Jools T~ Analyze
Iii ~ I -~ ..~ i·, ., <:: ,. I rDeb~g _ -- -=-1 Any CPU

Solution Explorer -la

----'-"-'-
G Eii1 ~ I ,.1
..:.I
. ::c:z:::·

I> ■-■ References


y] App.config
I> ~ Form1 .vb

(iv) Dock: Window is fixed to a dock on any one of the four borders of the window.
If the window is to be docked again, right click on tab, select Dock as shown in
Figure 1.20. Dock option is chosen for Solution Explorer window.
(v) Hide and Auto Hide: If Auto Hide is selected, the window is h~dden as shown
in Figure 1.21. In Auto Hide mode, when window is clicked, the complete
window appears. To bring back the window, click on window, select Dock
option from Window Position as shown in Figure 1.22.
-
I ll INTRODUCTION TO VB.NET
' .
Visual Basic .NET (VB.NET) is an object-oriented programming language su
by .NET Framework. It was launched by Microsoft in 2002. Visual Basic ~:;e_ci
successor to VB6, but it is not backward compatible with VB6. However l~
, 1atest
versions of .NET. framework support- -older versions of .NET Framework. The Wor
'Visual' refers to the visual -appeal of Graphical User Interface (GUI, pronounced It
GOOEY) and the 'Basic' word is taken from an earlier language 'Beginners All Purp0: :
Symbolic Instruction Code'. The word 'NET' stands for network as this language
includes functionality for developing web applications and services. The 2;1am features
of VB. NET are as follows --..
► VB.NET is an object-oriented programming language as it supports classes,
objects, abstraction, inheritance and polymorphism concepts of object-oriented
paradigm.
► VB.NET provides Rapid Application Development (RAD) environment whic
helps programmers in developing applications quickly. Programmers d o n o
have to spend much time on creating appearance of user interface elements
such as TextBox, Label and many more, rather they can be placed on a Fonn
just by dragging and dropping.
► VB.NET enables programmers to develop GUis that can be used as front end for
database related applications. A typical GUI includes visual components such
as TextBoxes, Labels and Buttons. Due to visual appeal, GUI based applications
are preferred over console applications, also called Character User Interface
(CUI) applications.
► VB.NET is an event driven programming language. It allows user in writing code
which is executed"anly when a particular even t fires such as clicking of a mouse
or a key.
► VB.NET supports procedures and functions for supporting modular
programming.
► VB.NET also provides classes to creE!te web applications and web services. It
becomes easy for the user to learn and develop different types of applications
using familiar interface.

1. 7 .1 Writing and Executing a VB.NET Program


Visual Basic has two distinct environments, Design Environment and Debug
Environment. In the Design environment, the VB.NET form (program) is designed and
code is written. In the Debug environment, the program is executed and the locations
of errors are produced in case of errors in the code. The following steps are carried to
d esign and write a VB.NET program.
Qtl8ruiew of visual Stumo .NET

► Build a Graphical User Interface


• Add controls from the Toolbox to the Form.
-
• Customize the properties of various controls.
► Write code
Write code for the relevant controls -so that they can respon se to events

triggered by the user's actions such as clicking a button or menu option. L
► Execut e or Run VB.NET Project

• Clic½ at Del?ug ~enu and.the~ Start o; Pr~~~ FS ·key]


1. 7.2 Introd uction to Comm only Used Contro ls in VB.NET
During the designing of Graphical User Interface (GUI) for the VB.NET program ,
controls like Label, TextBox and many more are required. In this section , commonly
used controls - Label, TextBox and Button are given briefly so as to enable a user to
write a small VB.NET project. The details of these controls are given in Chapte r 4.
► Label Control: The Label control in VB.NET is used to displ~y informative text
on the Form.
► TextBo x Control: TextBox control in VB.NET is used to get user input at
run
time. It is also used to display the text.
► Button Control: Button Control is used to trigger some action during run
time
on -occurr ence of an event such as clicking the button. The Click event of a
Button occurs when user clicks on Button during run ffme and ·e xecute s the
corresp onding code.
These control s are selecte d from Tool Box and placed on the form either by draggin g
--
and droppin g them onto Form or by double clicking them. The latter option places
control s on the upper left side of the Form from where they can be moved to the
require d location.
The two main propert ies of these three controls are given as follows .
,. Name: This propert y is used to uniquely identify the object which may be a
label, TextBox or Button .
, Text: This propert y is used for different controls as given below.
• For Label control, this propert y is used to display the text/m essage on
screen.
• For TextBox control , this propert y gets or sets the text from/in the TextBox.
• For Button control, this propert y display s the text assigne d to it as Button
caption .
The propert ies of these control s can be set during design time or at run time using
by
code. The Figure 1.23 shows these three control s on VB.NET form followed
properties set during design time.

)
>

OVeruiew of Vjsual Stlfbio ~

Figure 1.23: Demo of Basic Controls and their Properties

Label Control

TextBox Control
Labell
~ - - - -I~

1 IUtonl
l __ __ _ ,
. .
- - - - - -, - ButtonControl

• q X

l :!! ~' I ~ f I ,.
l ft.lStylt Sundtrd
Text' property of Label is set to jf3 font Miuo,oll S,,ns Sen, ~
'Enter Value'. After setting, it looks J Fo,.Calo< ■ Con1ro1Tet
like as given below. Similarly, the l lm19t ·--- □ ~ --
MiddltC.....,
remaining properties ~ be set~ I IIN9fAlign
lm,9elndo O c-i
lm19<ky o ,-i
J:l Form1 l.,o..:J!' ~ l""'9M1 c,-e)
No
R'9htloldt

-
Tat Enlerv.li,e
TotAign Toplcft
True
&ter Vu -------J
._I I U..Wtit<:ursor Ftlse
Jg ............

1.7.3 Built -in Functions for Displaying a Me-1e


VB.NET also provides many built-in functions . The most commonly used functions
to display user-defined messages are described as follows.
, MsgBox(String) or MessageBox.show(Strin1): These functions are used to
g.isplay a message inside a dialog box during run time. The text to be displayed
is passed to these functions . The purpose of MsgBox() and MessageBox.show() is
same. For example,
MsgBox("Hello")
MessageBox.show ("Hello")

I . 7 . 4 The Close() method


This method of Form object is used to close the form. For example,
me.Close() 'where me refers to currently active Form.

I. 7.5 First VB.NET Project to Display a Message


Create a project and solution with name FirstVBNetS olution. Add a Button control
and change its text to 'Click Here'. On clicking this button, display a message
Welcome to the World of GUI Application'. Add another button with caption Exit. On
clicking this button, close the form . Figure 1.24 shows the design time layout of Form,
Solution Explorer and Property settings.
overview of Visual Stubio .NET

Figure 1.24: Design Time layout ot Form, Solution E.xplor9r Ind Property Settlngs
:;=;:-0
Form,- ~~--~c
,,-.~...-= =:,
::;•~fiii1
Solution Explorer • J , Propetbes • i 'JC

(J C I
t'.i'l '(9 • ~ G ~ '® I () , .. ....._, ~Wndow'Jo:-,r~

Search Solution Explorer (Ctr!•;) p. ~ 9'i)f >-


~ FlrstYBNetSolution l~e-1
} MyProject ~
Rightlol.!ft ~io
~ •·• Rfferences
yJ App.config CJdiMIR
~ ~ Form1.vb
Tt.l!Aign J.Wcil<tmr
TmlrNge9al!Ull0n ~

llseMnemonoc T""

Form Layout Solution Explorer Properties Window

To execute the Form; click on Start button available at top. The Form wi!J start its
execution. Figure 1.25 shows the run time screen. On clicking button 'Click Here·, 8
dialog box with message will appear as shown in the right side of Figure 1.24. When
button Ok is clicked, the control will come back to form. Then click on Exit button to
close the Form. It will stop execution. Project 1.1 shows the code.

Figure 1.25: Run Time Screen and MessageBoxO

~ Form1 D X

I Oc:k Here Ext Welcome to the World of GUI Apphc.at1on

Ol

Project 1.1: Displaying Welcome Message

Public Class Form 1


Private Sub Buttonl_Click(sender As Object, e As EventArgs) Handles Buttonl.Click
MessageBox.Show("Welcome to the World of GUI Application")
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Me.Close()
End Sub
End Class
i-
I

OUeruiew of Vi&JCai ~
Save the project and solution. The files can be saved in default path or th •
h . Th e Path
your c 01~e. e default_path is 'C: \Users\ <user name>\ Documents\Visuai Stu ~!
2015-~ProJects .. Under this default path or path of developer's choice, a folder ~ 10
solution name 1s created. In case of this example, solution name is 'FirstVBNetS 1 . th
and it is stored in e: \ vbprojects folder. The physical structure of this solution :/tioir
a~ shown in the left side of Figure 1.26. The solution file is stored at one level up ~;~
hierarchy as shown on right side of Figure 1.26. t

Figure 1.26: Physical Structure of Solution

} bin
. My Project
obj
Name
Y~App
~ FirRVBNetSolutK>n
"
.firstVBNetSofution
·!
.QD F irst.VBNetSolutoon.vbproj ··- --··
. - - -.. _.,.. - -- ....
' .... .,
lib
C,
Forml.Oes.igner.vb
Forn-ol
,gg FirstVBNetSolution
fill Form"l .vb

\
• DEVELOPING CONSOLE APPLICATIONS IN VB.NET \
I
Console applications are also called Character User Interface (CUI) ApJ?lications.
1
Such applications are easy to develop in comparison to Graphical User _Interface (GUij
applications. A console application is used to read input data from console and write
output data to console. The Languages like C and Java support console applications.
A console application in VB.NET is executed in DOS environment and it does not
use graphics. It is considered efficient as it consumes fewer resources. When console
application is executed, operating system provides three input and output streams to
console application named as standard input stream, standard output stream and
standard error output stream.
Console applications use a system namespace called Console. The Console
namespace includes methods required to read input and write output from/to console,
The commonly used methods are described in brief as shown in the Table 1.1.

Table 1.1: Commonly used Methods for Console Applications

Method Description
Write This method writes string to standard output.
Writeline This method writes string to standard output followed by a newline
character.
Readkey This method reads one character at a time from standard input.
Read This method reads next character from standard input.
Readline This method reads entire line.
overviewof Visual ~tJWio NET

1.8.l Steps to Develop and Execute a Console Application


(i)Go to File menu in the VS.NET IDE
(ii)Select New Project
(iii)Select Template
(iv) Select Visual Basic
(v) Select Console Application
(vi) Give name to console application as shown in Figure 1.27.
Figure 1.27: Creating a Console Appllcatlon
X
New Projf<.t

~ R«tnt ..Nf.1:_Framework 4.5.Z_ • }Sort by. lDela~lt


• lrutall•d

~ Temp~ tcs
u Windows Forms Applic.ation Vuuc?IB.!s.ic
T,,c ..-~...i S.,-:
A p,o,«J la, a wn;• ,..,.,,..,,... .....

-~ -
.. Visual Brnc

Unrlersal
r··J
•••
ii
IVPF Applic,tion Vau.:I 64sic

'flSUOI Basic
tpplou'. x,n

,....
Console Application
Windows8
Classic Desktop Shared Project lftSual 81SJc
Web
li.').J
Cloud n~••
~~
Cius l ibrary Viwal Bnic
Extensibility
LightSwitch 11~¥8 Clm l ibrary (Portable) Visual Bu,c
Officc/Shi,rePoint ~~
Silverlight
Test
WCF
Workflow
, Typ.Script
t, Other l anguages
L, Other Project Types
S.mplos

P Online
(lick here to 99 onlmc and find templates

Name JFirstConsoleApplicalio~

(vii) Click button OK


(viii) A Blank module having name 'Module 1' and extensi on '.VB' will appear as
shown in Figure 1.28. It has one procedu re (subroutine) , Main() , which is u sed
to write code.
(ix) Write code in 'sub Main()'
(x) To execute console application, click on start button ( ► Console applica tion ).
~11 start executing in DOS environment.
Figure 1.28: Module Structure

!ilfirn! C~~
- - ~a ·1;~_.l,1 t
1.26 OVeruiew ~ VisMa{ StJtbio
~
1.8.2 Console Application Example
Write a console application to read two numbers, add them and write output
console. The source code of the Project is shown in Project 1.2. to

Project 1.2: Console Application for Adding Numbers

Module Module 1
Sub Main()
Console.WriteLihe("Program to add two numbers")
Console.Write("Enter first number ")
Dim no 1 = Console.ReadLine()
'dim is used to declare variable
Console.Write("Enter second number ")
Dim no2 = Console.ReadLine()
Console.Write("Addition is ")
Console.WriteLine(Clnt(nol) + Clnt(no2))
'CINT function is used to convert string to numeric
Console.ReadKey()
End Sub
End Module
The output is as follows.

~ file:///~/Users/In du Arora/AppData/local/Temporary Projects

::>rogram :o add :tJO ri..,r'.ibers


~nter first number 2
Enter second number 6
;'.,,ddition is 8

IE IMPORTING NAMESPACES
A ' namespace is a lo 'cal ouping· of related classes and interfaces of .NET
Framewor . They reside in assemblies, wh1c are ep oyable units containing details
a:bout classes, interfaces and structures. The first part up to the last dot of the full
------=,-----
name of a type indicates the namespace, while the last part specifies the type name.
For example, 'System.window.Forms' contains classes for creating User interface
elements. Namespaces can be used by any application using imports statement in
.NE1' Framework language.
The Imports statement helps in enabling types that are contained in a given
namespace to be referenced directly. A namespace name may be a single namespace or
overview of Visual Stu3io .N.ET

a st rin g of
ce
na
by
m
a
es
pe
pa ce s
· rio d.-
w he re
e~ac
h
. ~r un s
e. pa ce
·
IS se pa
· ra
· te-d from the next higher
level
-
na m es pa
DB
Imports Sy st em.Data.OLE us ed
ed at so ur ce co de file level an d ca nn ot be
ar e us
The Im po rt s st at em en ts ul e, in te rfa ce , pr oc ed ur e or block. Howeve r,
s, st ru ct ur e, mod en ts
with in na m es pa ce , cl as y nu m be r of Im po rts statements. These st at em
n co nt ai n an
ea ch so ur ce co de file ca O pt io n St ric t st at em en t. Bu t th es e st at em en ts
st at em en ts like t does
sh ould be w rit te n af te r ts like M od ul e or Cl ass. The Imports st at em en
n st at em en ly
m us t pr ec ed e de cl ar at io ts an d as se m bl ie s av ai lable to a project, bu t on
ot he r projec
no t m ak e el em en ts from es th at ar e al re ad y available to th e project.
alify na m
rem ov es th e ne ed to qu

INC,) SUMMARY
by M icr osof t. It is de signed to build Window
is developed ~an
Th e .NET Fr am ew or k y m or e ty pe s of applications. Developers
ns ol e an d m an
ba se d, Web ba se d, co la ng ua ge s su ch as VB .NET, C# etc. The _obJect
of pr og ra m m in g ne ty of
ch oo se fr om a va rie ty or e po w er fu l tool to develop an d deploy va
e VB.NET m
or ie nt ed fe at ur es m ak
ap pl ic at io ns .
ge Z 01
T e s t Y o u r K n o w le

, (I ) ti=t.,.,i,:ti~?4,1po•ne1'1nttis •of01.N:tET1Framework.
1. N am e m ai n co m
la ng ua ge s su pp or te d by .NET Framework.
2 . N am e
an d FCL.
3 . D es cr ib e CTS, CLR io ?
is .N ET fr am ew or k as so ci at ed with Visual St ud
4 . How

5 . W ha t is ID E?
io .NET?
6 . W ha t is V is ua l St ud . d ?
w in ow. d S 1 tI·on
e us e of pr op er ty ·
7. W ha t is th 'b th e files re la te to a O u
. D es cn e .
8 . W ha t is a Solut10n?
pl or er ? d. VB NET
9 . W ha t is So lu tio n Ex . .
f im po rt an t files us e In
10. Write th e ex
.
te ns w n °
.
is V B. N ET ca lle d RA D?
1 1. Why
, VR_N ET?

You might also like