dotnet pdf

53
Latha Mathav an Polytec hnic College Compute r Engineering LATHA MATHAVAN POLYTECHNIC COLLEGE KIDARIPATTI, MADURAI.  DEPARTMENT OF COMPUTER ENGINEERING III YEAR/ V- SEM (K-Scheme)  .NET PROGRAMMING MANUAL  Prepared By, M. Suganthi B.Tech.,  Lecturer/ CT. .Ne t Programming (!S em"

Upload: kumarecit

Post on 05-Jul-2018

252 views

Category:

Documents


0 download

TRANSCRIPT

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 1/53

Latha Mathavan Polytechnic College Computer Engineering

LATHA MATHAVAN POLYTECHNIC COLLEGE

KIDARIPATTI, MADURAI.

 DEPARTMENT OF COMPUTER ENGINEERING 

III YEAR/ V- SEM

(K-Scheme)

 .NET PROGRAMMING MANUAL

  Prepared By,M. Suganthi B.Tech.,

  Lecturer/ CT.

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 2/53

Latha Mathavan Polytechnic College Computer Engineering

E#.No$ % CONSOLE APPLICATION

&ate$

Aim

To accept a character 'rom conole and to chec) the cae o' the character.

A!!"#"$%& Re'%i#e

S*$+"#e Re'%i#e  %. &otNet *rame+or) 

  . B.Net

H"#+"#e Re'%i#e Computer +ith Pentium -/ &ual core proceor.

P#ce%#e

%. Clic) StartProgramMicroo'tiualStudio 0 Microo'tiualStudio 0 to

open the Microo't iualStudio (-&E".

. Select *ile Ne+ Pro1ect conole application.

2. 3pen the conole application 'orm.

4. 4'ter opening the conole application 'orm +rite the ource code.

0. Then convert the 5ppercae to Lo+ercae and Lo+ercae to 5ppercae +ith the 'unction

o' 5cae and Lcae.

6. *inally run the conole application.

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 3/53

Latha Mathavan Polytechnic College Computer Engineering

S%#ce Ce

 Module Module%

  Su7 Main("  &im c 4 Char 

  Conole.8riteLine(9Enter the character9"  c : Conole.;eadLine  -' 4c(c" < 6= 4nd 4c(c" > ?% Then

  Conole.8riteLine(95PPE;C4SE9"

  Ele-' 4c(c" < ?6 4nd 4c(c" > % Then

  Conole.8riteLine(9L38E;C4SE9"  Ele

  Conole.8riteLine(93ther character9"

  End -'   Conole.;eadLine("

  End Su7

End Module

;ES5LT$

Thu the a7ove program 'or chec)ing the cae o' the character +a e#ecuted ucce'ully and the

output +a veri'ied.

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 4/53

Latha Mathavan Polytechnic College Computer Engineering

E#.No$ VOELS

&ate$

Aim

8rite a program to accept a character 'rom )ey7oard and diplay +hether it i a

vo+el or not.

A!!"#"$%& Re'%i#e

S*$+"#e Re'%i#e  %. &otNet *rame+or) 

  . B.Net

H"#+"#e Re'%i#e Computer +ith Pentium -/ &ual core proceor.

P#ce%#e

%. Clic) StartProgramMicroo'tiualStudio 0 Microo'tiualStudio 0 to

open the Microo't iualStudio (-&E".

. Select *ile Ne+ Pro1ect 8indo+ application.

3. 3pen the +indo+ application 'orm, and then place the la7el, Te#t7o# and 7utton in the

'orm.

=. -nert the code 'or Button Clic) Event procedure uing -* tatement to chec) +hether the

character i vo+el or not.

0. *inally run the +indo+ application.

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 5/53

Latha Mathavan Polytechnic College Computer Engineering

S%#ce Ce

Pu7lic Cla e#p

  Private Su7 Button%@Clic)(Byal ender 4 Sytem.371ect, Byal e 4 Sytem.Event4rg"Aandle Button%.Clic) 

  &im d 4 Char   d : 5Cae(Te#tBo#%.Te#t"  -' d : 949 3r d : 9E9 3r d : 9-9 3r d : 939 3r d : 959 Then

  Te#tBo#.Te#t : 9-t a vo+el9

  Ele

  Te#tBo#.Te#t : 9Not a vo+el9  End -' 

  End Su7

End Cla

RESULT

Thu the a7ove program 'or diplaying +hether the given character i vo+el or not +a e#ecuted

ucce'ully and the output +a veri'ied.

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 6/53

Latha Mathavan Polytechnic College Computer Engineering

E#.No$ 2 CASE CONVERSION

&ate$

Aim

8rite a B.Net program to accept a tring and convert the cae o' the character.

A!!"#"$%& Re'%i#e

S*$+"#e Re'%i#e  %. &otNet *rame+or) 

  . B.Net

H"#+"#e Re'%i#e Computer +ith Pentium -/ &ual core proceor.

P#ce%#e

%. Clic) StartProgramMicroo'tiualStudio 0 Microo'tiualStudio 0 to

open the Microo't iualStudio (-&E".

. Select *ile Ne+ Pro1ect +indo+ application.

3. 3pen the +indo+ application 'orm, and then place the la7el, Te#t7o# and 7utton in the

'orm 'rom tool 7o#.

=. -nert the code to convert the 5ppercae to Lo+ercae and Lo+ercae to 5ppercae +iththe 'unction o' 5cae and Lcae.

0. *inally run the +indo+ application.

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 7/53

Latha Mathavan Polytechnic College Computer Engineering

S%#ce Ce

Pu7lic Cla e#no2

  Private Su7 Button%@Clic)(Byal ender 4 Sytem.371ect, Byal e 4 Sytem.Event4rg"

Aandle Button%.Clic)   &im t 4 -nteger   t : String.Compare(Te#tBo#%.Te#t, 5Cae(Te#tBo#%.Te#t""

  -' t : Then

  Te#tBo#.Te#t : LCae(Te#tBo#%.Te#t"

  MgBo#(9The Lo+er cae i$9 Te#tBo#.Te#t"  Ele

  Te#tBo#.Te#t : 5Cae(Te#tBo#%.Te#t"

  MgBo#(9The 5pper cae i$9 Te#tBo#.Te#t"  End -' 

  End Su7

End Cla

RESULT

Thu the a7ove program 'or converting the cae o' the tring +a e#ecuted ucce'ully and the

output +a veri'ied.

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 8/53

Latha Mathavan Polytechnic College Computer Engineering

E#.No$ = ILE MENU OPERATION

&ate$

Aim

&evelop a menu 7aed B.Net application to implement a te#t editor +ith cut, copy,

 pate, ave and cloe operation.

A!!"#"$%& Re'%i#e

S*$+"#e Re'%i#e  %. &otNet *rame+or) 

  . B.Net

2. 4SP.Net

=. SL Server .

H"#+"#e Re'%i#e Computer +ith Pentium -/ &ual core proceor.

P#ce%#e

1. Clic) StartProgramMicroo'tiualStudio 0 Microo'tiualStudio 0 to

open the Microo't iualStudio (-&E".

. Select *ile Ne+ Pro1ect +indo+ application.

2. 3pen the +indo+ application 'orm, and then place the main menu in the 'orm 'rom tool

 7o#.

4. Maim menu i contructed +ith num7er o' u7 menu named a open, cloe, ave, cut,

copy, pate, undo, redo, color, 'ont etc.,

0. &rag and place a ;ichte#t7o# in the 'orm.

6. -nert the ource code 'or appropriate menu item and 'inally run the application.

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 9/53

Latha Mathavan Polytechnic College Computer Engineering

S%#ce Ce

Pu7lic Cla *orm%

  Private Su7 3penToolStripMenu-tem@Clic)(Byal ender 4 Sytem.371ect, Byal e 4

Sytem.Event4rg" Aandle 3penToolStripMenu-tem.Clic)   3pen*ile&ialog%.&e'aultE#t : 9D.t#t9  3pen*ile&ialog%.*ilter : 9Te#t *ileD.t#t9

  -' (3pen*ile&ialog%.Sho+&ialog : &ialog;eult.3F" 4nd

3pen*ile&ialog%.*ileName.Length < Then

  ;ichTe#tBo#%.Load*ile(3pen*ile&ialog%.*ileName,;ichTe#tBo#StreamType.PlainTe#t"

  End -' 

  End Su7

  Private Su7 CutToolStripMenu-tem@Clic)(Byal ender 4 Sytem.371ect, Byal e 4

Sytem.Event4rg" Aandle CutToolStripMenu-tem.Clic)   ;ichTe#tBo#%.Cut("

  End Su7

  Private Su7 CopyToolStripMenu-tem@Clic)(Byal ender 4 Sytem.371ect, Byal e 4

Sytem.Event4rg" Aandle CopyToolStripMenu-tem.Clic) 

  ;ichTe#tBo#%.Copy("  End Su7

  Private Su7 PateToolStripMenu-tem@Clic)(Byal ender 4 Sytem.371ect, Byal e 4

Sytem.Event4rg" Aandle PateToolStripMenu-tem.Clic)   ;ichTe#tBo#%.Pate("

  End Su7

  Private Su7 Select4llToolStripMenu-tem@Clic)(Byal ender 4 Sytem.371ect, Byal e 4

Sytem.Event4rg" Aandle Select4llToolStripMenu-tem.Clic) 

  ;ichTe#tBo#%.Select4ll("  End Su7

  Private Su7 5ndoToolStripMenu-tem@Clic)(Byal ender 4 Sytem.371ect, Byal e 4Sytem.Event4rg" Aandle 5ndoToolStripMenu-tem.Clic) 

  ;ichTe#tBo#%.5ndo("  End Su7

  Private Su7 ;edoToolStripMenu-tem@Clic)(Byal ender 4 Sytem.371ect, Byal e 4

Sytem.Event4rg" Aandle ;edoToolStripMenu-tem.Clic)   ;ichTe#tBo#%.;edo("

  End Su7

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 10/53

Latha Mathavan Polytechnic College Computer Engineering

Private Su7 SaveToolStripMenu-tem@Clic)(Byal ender 4 Sytem.371ect, Byal e 4Sytem.Event4rg" Aandle SaveToolStripMenu-tem.Clic) 

  Save*ile&ialog%.&e'aultE#t : 9D.t#t9

  Save*ile&ialog%.*ilter : 9Te#t *ileD.t#t9  -' (Save*ile&ialog%.Sho+&ialog : &ialog;eult.3F" 4nd

(Save*ile&ialog%.*ileName.Length < " Then  ;ichTe#tBo#%.Save*ile(Save*ile&ialog%.*ileName,;ichTe#tBo#StreamType.PlainTe#t"

  End -' 

  End Su7

  Private Su7 CloeToolStripMenu-tem@Clic)(Byal ender 4 Sytem.371ect, Byal e 4

Sytem.Event4rg" Aandle CloeToolStripMenu-tem.Clic) 

  End  End Su7

  Private Su7 CloeToolStripMenu-tem%@Clic)(Byal ender 4 Sytem.371ect, Byal e 4Sytem.Event4rg" Aandle CloeToolStripMenu-tem%.Clic) 

  Print&ialog%.&ocument : printdocument%

  Print&ialog%.PrinterSetting : Print&ocument%.PrinterSetting  -' Print&ialog%.Sho+&ialog : &ialog;eult.3F Then

  Print&ocument%.PrinterSetting : Print&ialog%.PrinterSetting

  End -' 

  End Su7

  Private Su7 *ontToolStripMenu-tem@Clic)(Byal ender 4 Sytem.371ect, Byal e 4

Sytem.Event4rg" Aandle *ontToolStripMenu-tem.Clic) 

  -' *ont&ialog%.Sho+&ialog : &ialog;eult.3F Then  ;ichTe#tBo#%.*ont : *ont&ialog%.*ont

  ;ichTe#tBo#%.*oreColor : *ont&ialog%.Color 

  End -' 

  End Su7

  Private Su7 ColorToolStripMenu-tem@Clic)(Byal ender 4 Sytem.371ect, Byal e 4

Sytem.Event4rg" Aandle ColorToolStripMenu-tem.Clic) 

  Color&ialog%.Sho+&ialog("  ;ichTe#tBo#%.*oreColor : Color&ialog%.Color 

  End Su7End Cla

RESULT

Thu the a7ove program 'or implementing 'ile menu operation +a e#ecuted ucce'ully and the

output +a veri'ied.

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 11/53

Latha Mathavan Polytechnic College Computer Engineering

E#.No$ 0 CALCULATOR 

&ate$

Aim

8rite a B.Net program to implement a calculator +ith memory and recall

operation.

A!!"#"$%& Re'%i#e

S*$+"#e Re'%i#e  %. &otNet *rame+or) 

  . B.Net

H"#+"#e Re'%i#e Computer +ith Pentium -/ &ual core proceor.

P#ce%#e

1. Clic) StartProgramMicroo'tiualStudio 0 Microo'tiualStudio 0 to

open the Microo't iualStudio (-&E".

. Select *ile Ne+ Pro1ect +indo+ application.

2. 3pen the +indo+ application 'orm.

4. Contruct the 'orm +ith ten 7utton 'or digit, 'our 7utton 'or operator, one 7utton 'or

memory recalling, one 7utton 'or ave to memory, one 7utton 'or unaved to memory.

0. Then inert the eparate ource code 'or digit, operator, memory recalling, memoryaved, unaved and calculation.

6. *inally run the +indo+ application.

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 12/53

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 13/53

Latha Mathavan Polytechnic College Computer Engineering

Private Su7 Button0@Clic)(Byal ender 4 371ect, Byal e 4 Sytem.Event4rg" AandleButton0.Clic) 

  Te#tBo#%.4ppendTe#t(909"

  End Su7

  Private Su7 Button6@Clic)(Byal ender 4 371ect, Byal e 4 Sytem.Event4rg" AandleButton6.Clic)   Te#tBo#%.4ppendTe#t(969"

  End Su7

  Private Su7 ButtonG@Clic)(Byal ender 4 371ect, Byal e 4 Sytem.Event4rg" AandleButtonG.Clic) 

  Te#tBo#%.4ppendTe#t(9G9"

  End Su7

  Private Su7 ButtonH@Clic)(Byal ender 4 371ect, Byal e 4 Sytem.Event4rg" Aandle

ButtonH.Clic)   Te#tBo#%.4ppendTe#t(9H9"

  End Su7

  Private Su7 Button?@Clic)(Byal ender 4 371ect, Byal e 4 Sytem.Event4rg" Aandle

Button?.Clic) 

  Te#tBo#%.4ppendTe#t(9?9"

  End Su7

  Private Su7 Button%@Clic)(Byal ender 4 371ect, Byal e 4 Sytem.Event4rg"

Aandle Button%.Clic) 

  Te#tBo#%.4ppendTe#t(99"  End Su7

  Private Su7 Button%%@Clic)(Byal ender 4 371ect, Byal e 4 Sytem.Event4rg"

Aandle Button%%.Clic) 

  a : al(Te#tBo#%.Te#t"

  op : 9I9  Te#tBo#%.Clear("

  End Su7

  Private Su7 Button%@Clic)(Byal ender 4 371ect, Byal e 4 Sytem.Event4rg"

Aandle Button%.Clic)   a : al(Te#tBo#%.Te#t"  op : 9!9

  Te#tBo#%.Clear("

  End Su7

 

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 14/53

Latha Mathavan Polytechnic College Computer Engineering

Private Su7 Button%2@Clic)(Byal ender 4 371ect, Byal e 4 Sytem.Event4rg" AandleButton%2.Clic) 

  a : al(Te#tBo#%.Te#t"

  op : 9D9  Te#tBo#%.Clear("

  End Su7

  Private Su7 Button%=@Clic)(Byal ender 4 371ect, Byal e 4 Sytem.Event4rg"

Aandle Button%=.Clic) 

  a : al(Te#tBo#%.Te#t"

  op : 9/9  Te#tBo#%.Clear("

  End Su7

  Private Su7 Button%H@Clic)(Byal ender 4 Sytem.371ect, Byal e 4 Sytem.Event4rg"

Aandle Button%H.Clic) 

  Select Cae op  Cae 9I9

  Te#tBo#%.Te#t : a I al(Te#tBo#%.Te#t"

  Cae 9!9  Te#tBo#%.Te#t : a ! al(Te#tBo#%.Te#t"

  Cae 9D9

  Te#tBo#%.Te#t : a D al(Te#tBo#%.Te#t"

  Cae 9/9  Te#tBo#%.Te#t : a / al(Te#tBo#%.Te#t"

  End Select

  End Su7End Cla

RESULT

Thu the a7ove program 'or calculator control +a e#ecuted ucce'ully and the output +a

veri'ied.

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 15/53

Latha Mathavan Polytechnic College Computer Engineering

E#.No$ 6 CALENDAR 

&ate$

Aim

&evelop a 'orm in B.NET to pic) a date 'rom calendar control and diplay the day,

month and year detail in eparate te#t 7o#e.

A!!"#"$%& Re'%i#e

S*$+"#e Re'%i#e  %. &otNet *rame+or) 

  . B.Net

H"#+"#e Re'%i#e Computer +ith Pentium -/ &ual core proceor.

P#ce%#e

1. Clic) StartProgramMicroo'tiualStudio 0 Microo'tiualStudio 0 to

open the Microo't iualStudio (-&E".

. Select *ile Ne+ Pro1ect +indo+ application.

2. 3pen the +indo+ application 'orm.

4. Place the &ataTimePic)er control in the 'orm 8indo+ 'rom the Tool7o#.

0. Contruct 'orm +ith la7el, te#t7o#e and 7utton.

6. Then -nert the code in the clic) event procedure o' Button control a +ell a inert code

in the change event procedure o' &ateTimePic)er control.

G. *inally run the +indo+ application.

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 16/53

Latha Mathavan Polytechnic College Computer Engineering

S%#ce Ce

Pu7lic Cla *orm%

  Private Su7 &ateTimePic)er%@alueChanged(Byal ender 4 Sytem.371ect, Byal e 4

Sytem.Event4rg" Aandle &ateTimePic)er%.alueChanged  Te#tBo#%.Te#t : &ateTimePic)er%.alue.&ay  Te#tBo#.Te#t : &atePart(&ate-nterval.Month, &ateTimePic)er%.alue"

  Te#tBo#2.Te#t : &ateTimePic)er%.alue.Jear 

  Te#tBo#=.Te#t : &ateTimePic)er%.alue.Aour 

  End Su7End Cla

RESULT

Thu the a7ove program 'or diplaying the date, time uing calendar control +a e#ecuted

ucce'ully.

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 17/53

Latha Mathavan Polytechnic College Computer Engineering

E#.No$ G TIME ASED UI0 PROGRAM

&ate$

Aim

&evelop a 'orm in B.NET application to per'orm timer 7aed Kui o' % Kuetion.

A!!"#"$%& Re'%i#e

S*$+"#e Re'%i#e  %. &otNet *rame+or) 

  . B.Net

H"#+"#e Re'%i#e Computer +ith Pentium -/ &ual core proceor.

P#ce%#e

%. Clic) StartProgramMicroo'tiualStudio 0 Microo'tiualStudio 0 to

open the Microo't iualStudio (-&E".

2. Select *ile Ne+ Pro1ect +indo+ application.

2. 3pen the +indo+ application 'orm.

=. Place three command 7utton, three radio 7utton, La7el, Timer control and roup 7o#'rom the Tool7o#.

0. -nert the code in the Timer clic) event uing cae tatement.

6. Then -nert the code in the 7utton clic) event 'or ne#t Kuetion uing Cae tatement.

G. *inally run the +indo+ application.

S%#ce Ce

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 18/53

Latha Mathavan Polytechnic College Computer Engineering

Pu7lic Cla Kui

  Pu7lic cnt 4 -nteger :

  Pu7lic tot 4 -nteger :   Private Su7 Kui@Load(Byal ender 4 Sytem.371ect, Byal e 4 Sytem.Event4rg"

Aandle MyBae.Load  ;adioButton%.Chec)ed : *ale  ;adioButton.Chec)ed : *ale

  La7el%.Te#t : 98ho i the leading contri7uter 'or 1ava9

 

;adioButton%.Te#t : 9Oame oling9  ;adioButton.Te#t : 9 &eni ;itchie9

  End Su7

  Private Su7 Timer%@Tic)(Byal ender 4 Sytem.371ect, Byal e 4 Sytem.Event4rg"

Aandle Timer%.Tic)  

cnt : cnt I %

  Select Cae cnt  Cae %

  -' (;adioButton%.Chec)ed : True" Then

  tot : tot I %

  End -'   ;adioButton%.Chec)ed : *ale

  ;adioButton.Chec)ed : *ale

  La7el%.Te#t : 98ho i the CE3 o' 8ipro9

  ;adioButton%.Te#t : 9Narayana Moorthy9  ;adioButton.Te#t : 9 4im prem1i9

  Cae   -' (;adioButton.Chec)ed : True" Then

  tot : tot I %

  End -' 

  ;adioButton%.Chec)ed : *ale  ;adioButton.Chec)ed : *ale

  La7el%.Te#t : 98ho i our college chairman9

  ;adioButton%.Te#t : 9latha9  ;adioButton.Te#t : 9 mathavan9

  Cae 2  -' (;adioButton.Chec)ed : True" Then  tot : tot I %

  End -' 

  ;adioButton%.Chec)ed : *ale  ;adioButton.Chec)ed : *ale

  La7el%.Te#t : 98hat i the 'irt 3S ued in mo7ile9

  ;adioButton%.Te#t : 9Sym7ion9

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 19/53

Latha Mathavan Polytechnic College Computer Engineering

;adioButton.Te#t : 9 android9 

Cae =

  -' (;adioButton%.Chec)ed : True" Then  tot : tot I %

  End -'   ;adioButton%.Chec)ed : *ale  ;adioButton.Chec)ed : *ale

  La7el%.Te#t : 98hich i the leading -T indutry in -ndia9

  ;adioButton%.Te#t : 9-n'oy9

  ;adioButton.Te#t : 9 TCS9  Cae 0

  -' (;adioButton.Chec)ed : True" Then

  tot : tot I %  End -' 

  ;adioButton%.Chec)ed : *ale

  ;adioButton.Chec)ed : *ale  La7el%.Te#t : 98ho i the 'ounder o' apple9

  ;adioButton%.Te#t : 9Steve 7almer9

  ;adioButton.Te#t : 9Steve 1o79  Cae 6

  -' (;adioButton.Chec)ed : True" Then

  tot : tot I %

  End -'   ;adioButton%.Chec)ed : *ale

  ;adioButton.Chec)ed : *ale

  La7el%.Te#t : 99

  ;adioButton%.Te#t : 99  ;adioButton.Te#t : 99

  ;adioButton.Ena7led : *ale  ;adioButton%.Ena7led : *ale

  MgBo#(9your Total Score i 9 tot"

  End Select

  End Su7

 

End Cla

RESULT

Thu the a7ove program 'or timer 7aed Kui +a e#ecuted ucce'ully and the output +a

veri'ied .

E#.No$ H ILE, DIRECTORY AND DRIVE OPERATIONS

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 20/53

Latha Mathavan Polytechnic College Computer Engineering

&ate$

Aim

&evelop a B.NET application uing the *ile, &irectory and drive control to

implement a common dialog 7o#.

A!!"#"$%& Re'%i#e

S*$+"#e Re'%i#e  %. &otNet *rame+or) 

  . B.Net

H"#+"#e Re'%i#e Computer +ith Pentium -/ &ual core proceor.

P#ce%#e

%. Clic) StartProgramMicroo'tiualStudio 0 Microo'tiualStudio 0 to

open the Microo't iualStudio (-&E".

. Select *ile Ne+ Pro1ect +indo+ application.3pen the +indo+ application 'orm.

3. Place the &rive Lit Bo#, &irectory Lit Bo#, *ile Lit Bo#, Te#t7o#, Button 'rom the

Tool7o#.

=. -nert the code 'or elected -nde# Changed event in the &rive, &irectory, *ile lit7o#.

0. Then place the image at run time 'or Button clic) event.

6. *inally run the +indo+ application.

S%#ce Ce

Pu7lic Cla e#pnoH

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 21/53

Latha Mathavan Polytechnic College Computer Engineering

Private Su7 Button%@Clic)(Byal ender 4 Sytem.371ect, Byal e 4 Sytem.Event4rg"

Aandle Button%.Clic) 

  &im ptr 4 String

  ptr : Com7oBo#%.Selected-tem I 99 I Com7oBo#.Selected-tem I 99 ICom7oBo#2.Selected-tem  MgBo#(ptr"

  PictureBo#%.-mageLocation : ptr 

  End Su7

End Cla

RESULT

Thu the a7ove program 'or implementing 'ile, directory and drive control +a e#ecuted

ucce'ully and the output +a veri'ied.

E#.No$ ? DISPLAY THE STUDENT INORMATION USING ADO.NET

&ate$

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 22/53

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 23/53

Latha Mathavan Polytechnic College Computer Engineering

Private Su7 *orm%@Load(Byal ender 4 Sytem.371ect, Byal e 4 Sytem.Event4rg"Aandle MyBae.Load

  &im con 4 Ne+ SKlConnection

  &im ada 4 Ne+ SKl&ata4dapter   &im d 4 Ne+ &ataSet

  &im cmd 4 Ne+ SKlCommand  Try  con.ConnectionString : 9&ata Source:P;4F4SA!46&C4-nitial

Catalog:tu-ntegrated Security:true9

  con.3pen("

  ada : Ne+ SKl&ata4dapter(9elect D 'rom tud9, con"  ada.*ill(d, 9tud9"

  Te#tBo#%.&ataBinding.4dd(9te#t9, d, 9tud.name9"

  Te#tBo#.&ataBinding.4dd(9te#t9, d, 9tud.rollno9"  Te#tBo#2.&ataBinding.4dd(9te#t9, d, 9tud.7ranch9"

  Te#tBo#=.&ataBinding.4dd(9te#t9, d, 9tud.year9"

  7m : Me.BindingConte#t(d, 9tud9"  Catch e# 4 E#ception

  MgBo#(e#.Meage"

  End Try  End Su7

  Private Su7 Button%@Clic)(Byal ender 4 371ect, Byal e 4 Sytem.Event4rg" Aandle

Button%.Clic)   7m.Poition :

  End Su7

  Private Su7 Button@Clic)(Byal ender 4 Sytem.371ect, Byal e 4 Sytem.Event4rg"Aandle Button.Clic) 

  7m.Poition I: %  End Su7

  Private Su7 Button2@Clic)(Byal ender 4 Sytem.371ect, Byal e 4 Sytem.Event4rg"

Aandle Button2.Clic)   7m.Poition !: %

  End Su7

  Private Su7 Button=@Clic)(Byal ender 4 Sytem.371ect, Byal e 4 Sytem.Event4rg"

Aandle Button=.Clic)   7m.Poition : 7m.Count ! %  End Su7

End Cla

SL Cmm"1&

P#ce%#e

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 24/53

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 25/53

Latha Mathavan Polytechnic College Computer Engineering

E#.No$ % STUDENT DATAASE USING ADO.NET

&ate$

Aim

&evelop a data7ae application uing 4&3.NET to inert, modi'y, update and delete

operation.

A!!"#"$%& Re'%i#e

S*$+"#e Re'%i#e  &otNet *rame+or),B.Net, 4SP.Net, SL Server .

H"#+"#e Re'%i#e Computer +ith Pentium -/ &ual core proceor.

P#ce%#e

%. 3pen the +indo+ application 'orm.

. Contruct the 'orm +ith la7el, te#t7o#e and 7utton 'rom tool7o#.

2. *irt add ne+ record to the e#iting ta7le 'or clic) event. That i all the te#t7o#e are et

to clear.

=. Then inert the ne+ record uing &ata Binding method to te#t property o' the te#t7o#

control and to 'etch the data 'rom the 'ield in the ta7le.

0. 8ith the ue o' E#ecuteNonuery method o' 3le&7 Command to inert ne+ record to

the ta7le and a'ter inerting, data7inding related to all te#t7o#e are cleared.

6. The E#ecuteNonuery(" method end the SL command to the &ata7ae erver.

G. Then call in our QMy dataetR dataet o71ect.

H. 4'ter inerting the ne+ record then identi'y the current poition +ith the help o'

my7ind.poition.

?. Then delete the e#iting record 'rom the ta7le +ith the help o' E#ecuteNonuery tring

command, updated 'rom the ta7le +ith the 3le&7&ata4dapter.

%. *inally run the application.

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 26/53

Latha Mathavan Polytechnic College Computer Engineering

D"$"A"!$e# C1*i4%#"$i1 i5"# "1 C11ec$i1

%. -n the Tool7o#, elect the data ta7, &rag an 3le&7 &ata4dapter on to the deign inter'ace

o' the component.

. No+ open the &ata4dapter con'iguration +iard then chooe your ne+ &ata Connectionthen clic) Ne#t 7utton.

2. Then &ata Lin) propertie +indo+ appeared.

=. -n &ata Lin) propertie, *irt ta7 elect the name o' the provider, econd ta7 elect the

connection, i.e., elect the name o' the erver, uer name, data7ae name.

0. Then pre the tet connection 7utton to chec) i' +e have correctly con'igured the

connection.

6. Then pre 3) 7utton to create the connection.

G. Then the uery type +indo+ +ill appear, +e have to elect the data adapter 7y uing

SL tatement or tored procedure.

H. Then pre the Ne#t 7utton, the creen appear called a generate the SL tatement.

?. -n thi +indo+, the SL command can 7e typed manually or +e can 'orm command

through the SL uery Builder(Select the uery 7uilder 7utton".

%. 3n the 'irt dialog that appear, elect the ta7le name and pre the 4dd 7utton, and then

 pre cloe.

%%. 4'ter electing 3F 7utton, the reulting creen appear i.e., top o' the 7o# in the uery

 7uilder +indo+, lit the column in the ta7le, then chec) all the column, then pre 3F

 7utton.

%. 4'ter the completion o' uery Builder, pre the Ne#t 7utton, then appear the ie+

8iard reult to generate the 3le&7 &ata4dapter +a con'igured ucce'ully.

D"$"Se$

%. To generate the dataet, right clic) the 3led7 &ata4dapter 

. Then appear the generate &ataSet +indo+ then chooe the ta7le to 7e added +ith the

&ataSet then pre 3F 7utton.

2. Then place the ne+ dataet in the 'orm.

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 27/53

Latha Mathavan Polytechnic College Computer Engineering

S%#ce Ce

-mport Sytem.&ata.SKlClient

Pu7lic Cla e#no%

  &im con 4 Ne+ SKlConnection  &im ada 4 Ne+ SKl&ata4dapter 

  &im d 4 Ne+ &ataSet

  &im cmd 4 Ne+ SKlCommand  &im 7m 4 BindingManagerBae

  &im dr 4 SKl&ata;eader 

  Private Su7 e#no%@Load(Byal ender 4 Sytem.371ect, Byal e 4 Sytem.Event4rg"Aandle MyBae.Load

 

con.ConnectionString : 9&ata Source:P;4F4SA!46&C4-nitialCatalog:tu-ntegrated Security:true9

  con.3pen("  ada : Ne+ SKl&ata4dapter(9elect D 'rom tud9, con"

  ada.*ill(d, 9tud9"  Te#tBo#%.&ataBinding.4dd(9te#t9, d, 9tud.name9"

  Te#tBo#.&ataBinding.4dd(9te#t9, d, 9tud.rollno9"

  Te#tBo#2.&ataBinding.4dd(9te#t9, d, 9tud.7ranch9"  Te#tBo#=.&ataBinding.4dd(9te#t9, d, 9tud.year9"

  7m : Me.BindingConte#t(d, 9tud9"

  End Su7

  Private Su7 Button%@Clic)(Byal ender 4 371ect, Byal e 4 Sytem.Event4rg" AandleButton%.Clic)   cmd : Ne+ SKlCommand(9inert into tud value(V9 I Te#tBo#%.Te#t I 9V,9 I

Te#tBo#.Te#t I 9,V9 I Te#tBo#2.Te#t I 9V,9 I Te#tBo#=.Te#t I 9"9, con"

  cmd.E#ecuteNonuery("  MgBo#(9;ecord added ucce'ullyWWW9"

  End Su7

  Private Su7 Button@Clic)(Byal ender 4 371ect, Byal e 4 Sytem.Event4rg" Aandle

Button.Clic) 

  cmd : Ne+ SKlCommand(9delete 'rom tud +here rollno:9 I Te#tBo#.Te#t I 9 9, con"

  cmd.E#ecuteNonuery("  MgBo#(9;ecord deleted ucce'ully9"

  End Su7

  Private Su7 Button2@Clic)(Byal ender 4 371ect, Byal e 4 Sytem.Event4rg" Aandle

Button2.Clic) 

  cmd : Ne+ SKlCommand(9 update tud et name:V9 I Te#tBo#%.Te#t I 9V,7ranch:V9 ITe#tBo#2.Te#t I 9V, year:9 I Te#tBo#=.Te#t I 9+here rollno:9 I Te#tBo#.Te#t I 99, con"

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 28/53

Latha Mathavan Polytechnic College Computer Engineering

cmd.E#ecuteNonuery("  MgBo#(9;ecord - updated9"

  End Su7

  Private Su7 Button=@Clic)(Byal ender 4 371ect, Byal e 4 Sytem.Event4rg" Aandle

Button=.Clic)   Try  cmd : Ne+ SKlCommand(9elect D 'rom tud +here rollno:9 I Te#tBo#.Te#t I 99, con"

  dr : cmd.E#ecute;eader 

  dr.;ead("

  Te#tBo#%.Te#t : dr("  Te#tBo#2.Te#t : dr("

  Te#tBo#=.Te#t : dr(2"

  dr.Cloe("  Catch e# 4 E#ception

  MgBo#(9;ecord not 'ound9"

  dr.Cloe("  End Try

 

End Su7

  Private Su7 Button0@Clic)(Byal ender 4 Sytem.371ect, Byal e 4 Sytem.Event4rg"

Aandle Button0.Clic) 

  Te#tBo#%.Te#t : 99  Te#tBo#.Te#t : 99

  Te#tBo#2.Te#t : 99

  Te#tBo#=.Te#t : 99

  End Su7End Cla

RESULT

Thu the a7ove program 'or per'orming inert, delete, update and earch operation uing

4&3.NET +a e#ecuted ucce'ully and the output +a veri'ied.

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 29/53

Latha Mathavan Polytechnic College Computer Engineering

E#.No$ %% DISPLAY THE RECORDS USING DATAGRID

&ate$

Aim

&evelop a B.Net application uing &atagrid to diplay record.

A!!"#"$%& Re'%i#e

S*$+"#e Re'%i#e  &otNet *rame+or),B.Net, 4SP.Net, SL Server .

H"#+"#e Re'%i#e Computer +ith Pentium -/ &ual core proceor.

P#ce%#e

%. 3pen the +indo+ application 'orm.

. Place the &tarid 'rom tool7o#.

2. Then create 3le&7 &ata4dapter, connection and &ataSet.

=. 4'ter creation o' 4dapter then open the property o' the &atarid , +e can et the &ata

ource and &ata mem7er.

0. Then inert the code in the *orm load event.

6. Then run the application to give tudent in'ormation through the grid.

D"$"A"!$e# C1*i4%#"$i1 i5"# "1 C11ec$i1

%. -n the Tool7o#, elect the data ta7, &rag an 3le&7 &ata4dapter on to the deign inter'ace

o' the component.

. No+ open the &ata4dapter con'iguration +iard then chooe your ne+ &ata Connection

then clic) Ne#t 7utton.

2. Then &ata Lin) propertie +indo+ appeared.

=. -n &ata Lin) propertie, *irt ta7 elect the name o' the provider, econd ta7 elect the

connection, i.e., elect the name o' the erver, uer name, data7ae name.

0. Then pre the tet connection 7utton to chec) i' +e have correctly con'igured the

connection.

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 30/53

Latha Mathavan Polytechnic College Computer Engineering

6. Then pre 3) 7utton to create the connection.

G. Then the uery type +indo+ +ill appear, +e have to elect the data adapter 7y uing

SL tatement or tored procedure.

H. Then pre the Ne#t 7utton, the creen appear called a generate the SL tatement.

?. -n thi +indo+, the SL command can 7e typed manually or +e can 'orm command

through the SL uery Builder(Select the uery 7uilder 7utton".

%. 3n the 'irt dialog that appear, elect the ta7le name and pre the 4dd 7utton, and then

 pre cloe.

%%. 4'ter electing 3F 7utton, the reulting creen appear i.e., top o' the 7o# in the uery

 7uilder +indo+, lit the column in the ta7le, then chec) all the column, then pre 3F

 7utton.

%. 4'ter the completion o' uery Builder, pre the Ne#t 7utton, then appear the ie+

8iard reult to generate the 3le&7 &ata4dapter +a con'igured ucce'ully.

D"$"Se$

%. To generate the dataet, right clic) the 3led7 &ata4dapter 

. Then appear the generate &ataSet +indo+ then chooe the ta7le to 7e added +ith the

&ataSet then pre 3F 7utton.

2. Then place the ne+ dataet in the 'orm.

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 31/53

Latha Mathavan Polytechnic College Computer Engineering

S%#ce Ce

-mport Sytem.&ata.SKlClient

Pu7lic Cla *orm%

  &im con 4 Ne+ SKlConnection

  &im ada 4 Ne+ SKl&ata4dapter   &im d 4 Ne+ &ataSet

  &im cmd 4 Ne+ SKlCommand

  &im 7m 4 BindingManagerBae

  Private Su7 *orm%@Load(Byal ender 4 Sytem.371ect, Byal e 4 Sytem.Event4rg"

Aandle MyBae.Load

  con.ConnectionString : 9&ata Source:P;4F4SA!46&C4-nitial

Catalog:tu-ntegrated Security:true9  con.3pen("

  ada : Ne+ SKl&ata4dapter(9elect D 'rom tud9, con"  ada.*ill(d, 9tud9"

  &ataridie+%.&ataSource : d.Ta7le("  7m : Me.BindingConte#t(d, 9tud9"

  End Su7

End Cla

RESULT

Thu the a7ove program 'or diplaying record uing &atarid vie+ +a e#ecuted ucce'ully

and the output +a veri'ied.

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 32/53

Latha Mathavan Polytechnic College Computer Engineering

E#.No$ % UPDATION O STUDENT INORMATION USING DATAGRID

&ate$

Aim

&evelop a B.Net application uing &atagrid to add, edit and modi'y record.

A!!"#"$%& Re'%i#e

S*$+"#e Re'%i#e  &otNet *rame+or),B.Net, 4SP.Net, SL Server .

H"#+"#e Re'%i#e Computer +ith Pentium -/ &ual core proceor.

P#ce%#e

%. 3pen the +indo+ application 'orm.

. Place the &tarid, 7utton 'rom tool7o#.

2. Then create 3le&7 &ata4dapter, connection and &ataSet.

=. 4'ter creation o' 4dapter then open the property o' the &atarid , +e can et the &ata

ource and &ata mem7er.

0. Then inert the code in the *orm load event.

6. Then run the application to edit, delete the tudent in'ormation through the grid.

D"$"A"!$e# C1*i4%#"$i1 i5"# "1 C11ec$i1

%. -n the Tool7o#, elect the data ta7, &rag an 3le&7 &ata4dapter on to the deign inter'ace

o' the component.

. No+ open the &ata4dapter con'iguration +iard then chooe your ne+ &ata Connection

then clic) Ne#t 7utton.

2. Then &ata Lin) propertie +indo+ appeared.

=. -n &ata Lin) propertie, *irt ta7 elect the name o' the provider, econd ta7 elect the

connection, i.e., elect the name o' the erver, uer name, data7ae name.

0. Then pre the tet connection 7utton to chec) i' +e have correctly con'igured the

connection.

6. Then pre 3) 7utton to create the connection.

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 33/53

Latha Mathavan Polytechnic College Computer Engineering

G. Then the uery type +indo+ +ill appear, +e have to elect the data adapter 7y uing

SL tatement or tored procedure.

H. Then pre the Ne#t 7utton, the creen appear called a generate the SL tatement.

?. -n thi +indo+, the SL command can 7e typed manually or +e can 'orm commandthrough the SL uery Builder(Select the uery 7uilder 7utton".

%. 3n the 'irt dialog that appear, elect the ta7le name and pre the 4dd 7utton, and then

 pre cloe.

%%. 4'ter electing 3F 7utton, the reulting creen appear i.e., top o' the 7o# in the uery

 7uilder +indo+, lit the column in the ta7le, then chec) all the column, then pre 3F

 7utton.

%. 4'ter the completion o' uery Builder, pre the Ne#t 7utton, then appear the ie+

8iard reult to generate the 3le&7 &ata4dapter +a con'igured ucce'ully.

D"$"Se$

%. To generate the dataet, right clic) the 3led7 &ata4dapter 

. Then appear the generate &ataSet +indo+ then chooe the ta7le to 7e added +ith the

&ataSet then pre 3F 7utton.

2. Then place the ne+ dataet in the 'orm.

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 34/53

Latha Mathavan Polytechnic College Computer Engineering

S%#ce Ce

-mport Sytem.&ata.SKlClient

Pu7lic Cla *orm%

  &im con 4 Ne+ SKlConnection

  &im ada 4 Ne+ SKl&ata4dapter   &im d 4 Ne+ &ataSet

  &im cmd 4 Ne+ SKlCommand

  &im 7m 4 BindingManagerBae  &im dr 4 SKl&ata;eader 

  Private Su7 *orm%@Load(Byal ender 4 Sytem.371ect, Byal e 4 Sytem.Event4rg"

Aandle MyBae.Load

  Try

  con.ConnectionString : 9&ata Source:P;4F4SA!46&C4-nitialCatalog:tu-ntegrated Security:true9

  con.3pen("  ada : Ne+ SKl&ata4dapter(9elect D 'rom tud9, con"

  ada.*ill(d, 9tud9"

  &ataridie+%.&ataSource : d.Ta7le("  Te#tBo#%.&ataBinding.4dd(9te#t9, d, 9tud.name9"

  Te#tBo#.&ataBinding.4dd(9te#t9, d, 9tud.rollno9"

  Te#tBo#2.&ataBinding.4dd(9te#t9, d, 9tud.7ranch9"  Te#tBo#=.&ataBinding.4dd(9te#t9, d, 9tud.year9"

  7m : Me.BindingConte#t(d, 9tud9"

  Catch e# 4 E#ception

  MgBo#(e#.Meage"

  End Try

  End Su7

  Private Su7 Button%@Clic)(Byal ender 4 371ect, Byal e 4 Sytem.Event4rg" Aandle

Button%.Clic) 

  cmd.Connection : con

  cmd : Ne+ SKlCommand(9inert into tud value(V9 I Te#tBo#%.Te#t I 9V,9 ITe#tBo#.Te#t I 9,V9 I Te#tBo#2.Te#t I 9V,9 I Te#tBo#=.Te#t I 9"9, con"

  cmd.E#ecuteNonuery("

  MgBo#(9;ecord added ucce'ullyWWW9"  End Su7

 

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 35/53

Latha Mathavan Polytechnic College Computer Engineering

Private Su7 Button@Clic)(Byal ender 4 371ect, Byal e 4 Sytem.Event4rg" AandleButton.Clic) 

  cmd.Connection : con  cmd : Ne+ SKlCommand(9delete 'rom tud +here rollno:9 I Te#tBo#.Te#t I 9 9, con"

  cmd.E#ecuteNonuery("  MgBo#(9;ecord deleted ucce'ully9"  End Su7

  Private Su7 Button2@Clic)(Byal ender 4 371ect, Byal e 4 Sytem.Event4rg" Aandle

Button2.Clic)   cmd.Connection : con

  cmd : Ne+ SKlCommand(9 update tud et name:V9 I Te#tBo#%.Te#t I 9V,7ranch:V9 I

Te#tBo#2.Te#t I 9V, year:9 I Te#tBo#=.Te#t I 9+here rollno:9 I Te#tBo#.Te#t I 99, con"  cmd.E#ecuteNonuery("

  MgBo#(9;ecord - updated9"

  End Su7

  Private Su7 Button=@Clic)(Byal ender 4 371ect, Byal e 4 Sytem.Event4rg" Aandle

Button=.Clic)   Try

  cmd.Connection : con

  cmd : Ne+ SKlCommand(9elect D 'rom tud +here rollno:9 I Te#tBo#.Te#t I 99, con"

  dr : cmd.E#ecute;eader   dr.;ead("

  Te#tBo#%.Te#t : dr("

  Te#tBo#2.Te#t : dr("

  Te#tBo#=.Te#t : dr(2"  dr.Cloe("

  Catch e# 4 E#ception  MgBo#(9;ecord not 'ound9"

  dr.Cloe("

  End Try

  End Su7

End Cla

RESULT

Thu the a7ove program 'or updating record uing &atarid vie+ +a e#ecuted ucce'ully

and the output +a veri'ied.

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 36/53

Latha Mathavan Polytechnic College Computer Engineering

E#.No$ %2 CLICK EVENT CREATION

&ate$

Aim

Create a imple 4SP.NET page to output Te#t +ith a 'orm, t+o ATML te#t7o#e, a

ATML 7utton, and an ATML>pan< element. Create an event procedure 'or the 7utton.

A!!"#"$%& Re'%i#e

S*$+"#e Re'%i#e  &otNet *rame+or),

4SP.Net

 

H"#+"#e Re'%i#e Computer +ith Pentium -/ &ual core proceor.

P#ce%#e

1. Clic) StartProgramMicroo'tiualStudio 0 Microo'tiualStudio 0 to

open the Microo't iualStudio (-&E".

. Select *ile Ne+ Pro1ect +e7 application.

2. Contruct 'orm +ith 7utton, te#t7o#e, Lit Bo# and &rop &o+n Lit 'rom tool7o#.

4. Set the property 4utopot7ac) a true 'or Lit Bo# and &rop do+n lit.

.

0. Then inert the code in the ie+ code 8indo+ 'or appropriate clic) event program

6. *inally run the +e7 application.

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 37/53

Latha Mathavan Polytechnic College Computer Engineering

S%#ce Ce

Pu7lic Cla @&e'ault

  -nherit Sytem.8e7.5-.Page

  Private Su7 Button%@Clic)(Byal ender 4 371ect, Byal e 4 Event4rg" Aandle

Button%.Clic)   Te#tBo#%.Te#t : 98elcome to Temple City9

  End Su7

  Private Su7 &rop&o+nLit%@Selected-nde#Changed(Byal ender 4 371ect, Byal e 4

Sytem.Event4rg" Aandle &rop&o+nLit%.Selected-nde#Changed

  Te#tBo#.Te#t : 9Jou have elected the color$9

 @&rop&o+nLit%.Selected-tem.alue.ToString  End Su7

  Private Su7 LitBo#%@Selected-nde#Changed(Byal ender 4 371ect, Byal e 4Sytem.Event4rg" Aandle LitBo#%.Selected-nde#Changed

  Te#tBo#.Te#t : 9Jou have elected the u71ect$9

 @LitBo#%.Selected-tem.alue.ToString  End Su7

End Cla

RESULT

Thu the a7ove program 'or creating a imple 4SP.NET page +a e#ecuted ucce'ully and the

output +a veri'ied.

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 38/53

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 39/53

Latha Mathavan Polytechnic College Computer Engineering

S%#ce Ce

Pu7lic Partial Cla 8e7*orm

  -nherit Sytem.8e7.5-.Page

  Protected Su7 Page@Load(Byal ender 4 371ect, Byal e 4 Sytem.Event4rg" AandleMe.Load  La7el%.ii7le : *ale

  End Su7

  Private Su7 Button%@Clic)(Byal ender 4 371ect, Byal e 4 Sytem.Event4rg" AandleButton%.Clic) 

  La7el%.ii7le : True

  La7el%.Te#t : &rop&o+nLit%.Selected-tem.Te#t I 9i ;eerved 'or you $!"9  &rop&o+nLit%.-tem.;emove(&rop&o+nLit%.Selected-tem.Te#t"

  -' &rop&o+nLit%.-tem.Count : Then

  Button%.Ena7led : *ale  End -' 

  End Su7

End Cla

RESULT

Thu the a7ove program 'or reerving hotel room uing 4SP.NET +a e#ecuted ucce'ully

and the output +a veri'ied.

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 40/53

Latha Mathavan Polytechnic College Computer Engineering

E#.No$ %0 REPEATER CONTROL USING ADO.NET

&ate$

Aim

Create an application 'or acceing a SL &ata7ae 7y uing 4&3.NET 7y

connecting to the SL erver data7ae and call a tored procedure. Then to diplay the data in a

repeater control.

A!!"#"$%& Re'%i#e

S*$+"#e Re'%i#e  &otNet *rame+or),B.Net, 4SP.Net, SL Server .

H"#+"#e Re'%i#e Computer +ith Pentium -/ &ual core proceor.

P#ce%#e

%. 3pen the 8e7 application 'orm.

. Place the ;epeater control 'rom tool 7o#.

2. Then create 3le&7 &ata4dapter, connection and &ataSet.

=. 4'ter creation o' 4dapter then open the property o' the &atarid , +e can et the &ata

ource and &ata mem7er.

0. Then inert the code in the *orm load event.

6. Then run the application to give tudent in'ormation through the ;epeater control.

D"$"A"!$e# C1*i4%#"$i1 i5"# "1 C11ec$i1

%. -n the Tool7o#, elect the data ta7, &rag an 3le&7 &ata4dapter on to the deign inter'ace

o' the component.

. No+ open the &ata4dapter con'iguration +iard then chooe your ne+ &ata Connection

then clic) Ne#t 7utton.

2. Then &ata Lin) propertie +indo+ appeared.

=. -n &ata Lin) propertie, *irt ta7 elect the name o' the provider, econd ta7 elect the

connection, i.e., elect the name o' the erver, uer name, data7ae name.

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 41/53

Latha Mathavan Polytechnic College Computer Engineering

0. Then pre the tet connection 7utton to chec) i' +e have correctly con'igured the

connection.

6. Then pre 3) 7utton to create the connection.

G. Then the uery type +indo+ +ill appear, +e have to elect the data adapter 7y uingSL tatement or tored procedure.

H. Then pre the Ne#t 7utton, the creen appear called a generate the SL tatement.

?. -n thi +indo+, the SL command can 7e typed manually or +e can 'orm command

through the SL uery Builder(Select the uery 7uilder 7utton".

%. 3n the 'irt dialog that appear, elect the ta7le name and pre the 4dd 7utton, and then

 pre cloe.

%%. 4'ter electing 3F 7utton, the reulting creen appear i.e., top o' the 7o# in the uery 7uilder +indo+, lit the column in the ta7le, then chec) all the column, then pre 3F

 7utton.

%. 4'ter the completion o' uery Builder, pre the Ne#t 7utton, then appear the ie+

8iard reult to generate the 3le&7 &ata4dapter +a con'igured ucce'ully.

D"$"Se$

%. To generate the dataet, right clic) the 3led7 &ata4dapter 

. Then appear the generate &ataSet +indo+ then chooe the ta7le to 7e added +ith the

&ataSet then pre 3F 7utton.

2. Then place the ne+ dataet in the 'orm.

 

S%#ce Ce

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 42/53

Latha Mathavan Polytechnic College Computer Engineering

&ou7le clic) the +e7.con'ig 'ile and +rite 'ollo+ing code in it$

>connectionString<

  >add name:9contr9 connectionString:9initial catalog:puran data ource:MCN

integrated ecurity:pi9/<

  >/connectionString<

De*"%2$."&!6 *i2e ce

>XY Page Language:9CZ9 4utoEvent8ireup:9true9 Code*ile:9&e'ault.ap#.c9

-nherit:9@&e'ault9 X<

>W&3CTJPE html P5BL-C 9!//82C//&T& [ATML %. Tranitional//EN9

9http$//+++.+2.org/T;/#html%/&T&/#html%!tranitional.dtd9<

>html #mln:9http$//+++.+2.org/%???/#html9<

>head runat:9erver9<  >lin) rel:9Styleheet9 type:9te#t/c9 hre':9StyleSheet.c9 /<

  >title<;epeater Control in 4SP.NET>/title<

>/head<

>7ody<

  >'orm id:9'orm%9 runat:9erver9<

  >div<

  >ap$;epeater -&:9;epeat-n'ormation9 runat:9erver9<

  >AeaderTemplate<

  >ta7le cla:9t7lcolor9<

  >tr<

  >7<

  >td<

  ;oll No

  >/td<

  >td<

  Student Name

  >/td<

  >td<

  Total *ee  >/td<

  >/7<

  >/tr<

  >/AeaderTemplate<

  >-temTemplate<

  >tr cla:9t7lro+color9<

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 43/53

Latha Mathavan Polytechnic College Computer Engineering

>td<

  >XZ&ataBinder.Eval(Container,9&ata-tem.;ollNo9"X<

  >/td<

  >td<

  >XZ&ataBinder.Eval(Container,9&ata-tem.Name9"X<

  >/td<

  >td<

  >XZ&ataBinder.Eval(Container,9&ata-tem.*ee9"X<

  >/td<

  >/tr<

  >/-temTemplate<

  >SeparatorTemplate<

  >tr<

  >td<

  >hr /<  >/td<

  >td<

  >hr /<

  >/td<

  >td<

  >hr /<

  >/td<

  >/tr<

  >/SeparatorTemplate<

  >4lternating-temTemplate<

  >tr<

  >td<

  >XZ&ataBinder.Eval(Container,9&ata-tem.;ollNo9"X<

  >/td<

  >td<

  >XZ&ataBinder.Eval(Container,9&ata-tem.Name9"X<

  >/td<

  >td<

  >XZ&ataBinder.Eval(Container,9&ata-tem.*ee9"X<  >/td<

  >/tr<

  >/4lternating-temTemplate<

  >SeparatorTemplate<

  >tr<

  >td<

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 44/53

Latha Mathavan Polytechnic College Computer Engineering

>hr /<

  >/td<

  >td<

  >hr /<

  >/td<

  >td<

  >hr /<

  >/td<

  >/tr<

  >/SeparatorTemplate<

  >*ooterTemplate<

  >tr<

  >td<

  School ;ecord diplayed

  >/td<  >/tr<

  >/ta7le<

  >/*ooterTemplate<

  >/ap$;epeater<

  >/div<

  >/'orm<

>/7ody<

>/html<

Ce 7ehi1 *i2e ce

uing Sytem

uing Sytem.Con'iguration

uing Sytem.&ata

uing Sytem.LinK

uing Sytem.8e7

uing Sytem.8e7.Security

uing Sytem.8e7.5-

uing Sytem.8e7.5-.AtmlControluing Sytem.8e7.5-.8e7Control

uing Sytem.8e7.5-.8e7Control.8e7Part

uing Sytem.[ml.LinK

uing Sytem.&ata.SKlClient

 pu7lic partial cla @&e'ault $ Sytem.8e7.5-.Page

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 45/53

Latha Mathavan Polytechnic College Computer Engineering

\

  SKlConnection con

  SKlCommand cmd : ne+ SKlCommand("

  protected void Page@Load(o71ect ender, Event4rg e"

  \

  con : ne+

SKlConnection(Con'igurationManager.ConnectionString]9contr9^.ConnectionString"

  cmd.Connection : con

  cmd.CommandTe#t : 9elect D 'rom tudent9

  con.3pen("

  ;epeat-n'ormation.&ataSource : cmd.E#ecute;eader("

  ;epeat-n'ormation.&ataBind("

  con.Cloe("

  _

_

RESULT

Thu the a7ove program 'or updating record uing 4SP.NET +a e#ecuted ucce'ully and the

output +a veri'ied.

E#.No$ %6 HOTEL MANAGEMENT USING E SERVICES

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 46/53

Latha Mathavan Polytechnic College Computer Engineering

&ate$

Aim

Create a +e7 ervice application 'or calling a 8e7 ervice 'or a hotel named 'ull, and

call another +e7 ervice 'or a hotel named Empty, and then retrieve in'ormation regarding roomavaila7ility. The +e7 ervice 'or 'ull hotel i named Aotel@*ull.dll. the +e7 ervice 'or the hotel

Empty i [email protected]. There are 'ive method in each ervice.

%. ;eerve ta)e room type and tart and end date and return a Boolean value that

indicate +hether a room i availa7le. >8e7Method("<pu7lic *unction ;eerve

(tr;oomType% 4 String, tr;oomType 4 String, dtmStart&ate 4 &ate, dtmEnd&ate

4 &ate" 4 Boolean

. Price return a dou7le value that i the cot o' the rent 'or one day >8e7Method("<pu7lic

*unction Price(tr;oomType% 4 String" 4 &ou7le

3. De&c#i!$i1 return a tring that decri7e the hotel. >8e7Method("<pu7lic *unction&ecription(" 4 String

4. Rm return a tring that decri7e the room o' the hotel. >8e7Method("<pu7lic

*unction ;oom(" 4 String

5. return a tring that decri7e the 'ood availa7le at the hotel. >8e7Method("<pu7lic

*unction *ood(" 4 String.

A!!"#"$%& Re'%i#e

S*$+"#e Re'%i#e  &otNet *rame+or),B.Net, 4SP.Net, SL Server .

H"#+"#e Re'%i#e Computer +ith Pentium -/ &ual core proceor.

P#ce%#e

%. 3pen the iual Baic .NET -&E.

2. Select *ile Ne+ Pro1ect 8e7 application to open the ne+ ap#.+e7 ervice 'ile.

2. Create variou 'unction 'or per'orming the operation o' ;eerve, Price, ;oom,

&ecription and *ood.

=. Then +rite the code in the coding +indo+.

0. *inally, run the +e7 ervice to produce output.

e7 Se#8ice

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 47/53

Latha Mathavan Polytechnic College Computer Engineering

%. 3pen a ne+ 4SP.NET +e7 ervice then clic) 3F.

. Create a ne+ pro1ect 'older name a 8e7Service.am and then clic) 3F.

2. 8rite the +e7 method *unction in current 8e7Service.am

=. Then run the 8e7Service.

0. Then give the 5;L addre o' the previou 8e7Service.am#

6. *inally give the 8e7 ;e'erence Name and clic) the 4dd;e'erence Button.

G. 8rite the code 'or the appropriate +e7 ervice method

H. ;un the program and veri'y the output.

S%#ce Ce

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 48/53

Latha Mathavan Polytechnic College Computer Engineering

Pu7lic cla Service%

-nherit Sytem.8e7.Service.8e7Service

Pu7lic *unction price(By al trroomtype% 4 String" 4 &ou7le

-' trroomtype%:RSingleR Then

;eturn %

Ele-' trroomtype%:R&ou7leR Then

;eturn

Ele-' trroomtype%:RLu#uryR Then

;eturn =

Ele-' trroomtype%:RoldR Then

;eturn 0

Ele-' trroomtype%:R&iamondR Then

;eturn %

End -' 

;eturn

End *unction

Pu7lic *unction ;oom(" 4 String("

&im roomtype 4 String : \QSingleR,R&ou7leR,RLu#uryR,RoldR,R&iamondR_

;eturn roomtype

End *unction

Pu7lic *unction *ood (" 4 String("

&im 'oodtype(" 4 String:\QChineeR,R-ndianR,RThaiR_

;eturn 'oodtype

End *unction

Pu7lic *unction decription(" 4 String

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 49/53

Latha Mathavan Polytechnic College Computer Engineering

&im 4 String

:R-T -S 4 2!ST4; A3TEL. 8E A4E &-**E;ENT TJPES 3* ;33MS 8-TA 4LL*4C-L-TJR

;eturn

Pu7lic *unction reerve(By al roomnum7er 4 String" 4 Boolean

Select cae roomnum7er 

Cae Qroom%R

;eturn True

End Select

End *unction

End Cla *unction

E APPLICATION

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 50/53

Latha Mathavan Polytechnic College Computer Engineering

Pu7lic cla 8e7*orm%

-nherit Sytem.8en.5-.Page

&im h a localhot.Service% : Ne+ localhot.Service%

&im i a localhot.Service% : Ne+ localhot.Service%

Private Su7 Page@Load(By al ender 4 Sytem.371ect, By al e 4 Sytem.Event4rg"

Aandle My7ae.Load

Count: True

La7el.Te#t: Q R

-' Not -PotBac) Then

&im tr 4 String

&im t 4 String

*or Each tr -n h.;oom("

&rop&o+nLit%.-tem.4dd(tr"

 Ne#t

La7el%.Te#t:h.decription("

End -' 

End Su7

Private Su7 &rop&o+nLit2@Selected-nde#Changed(By al ender 4 Sytem.371ect, By al e

4 Sytem.Event4rg" Aandle &rop&o+nLit2.Selected-nde#Changed

-' &rop&o+nLit2.Selected-nde# : % Then

-' Not -PotBac) Then

&im tr 4 String

&im t 4 String

*or Each tr -n h.;oom("

&rop&o+nLit%.-tem.;emove(tr"

&rop&o+nLit%.-tem.4dd(tr"

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 51/53

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 52/53

Latha Mathavan Polytechnic College Computer Engineering

*or Each tr% -n i.;oom("

&rop&o+nLit%.-tem.;emove(tr%"

&rop&o+nLit%.-tem.4dd(tr%"

 Ne#t

*or Each t% -n h.*ood("

&rop&o+nLit.-tem.;emove(t%"

&rop&o+nLit.-tem.4dd(t%"

 Ne#t

La7el%.Te#t: i.decription("

End -' 

End Su7

Private Su7 &rop&o+nLit%@Selected-nde#Changed(By al ender 4 Sytem.371ect, By al e

4 Sytem.Event4rg" Aandle &rop&o+nLit%.Selected-nde#Changed

-' &rop&o+nLit%.Selected-nde# <: Then

La7el2. Te#t: h.price(&rop&o+nLit.Selected-tem. ToString("".ToString(" I QR

La7el. Te#t: h.price(&rop&o+nLit%.Selected-tem. ToString("".ToString(" I QR

End -' 

Private Su7 Button%@Clic)(Byal ender 4 371ect, Byal e 4 Sytem.Event4rg" Aandle

Button%.Clic) 

 ;epone. 8rite(count"

Te#t7o#%.Te#t : Calender%. Selected&ate. ToShort&ateString("

Te#t7o#.Te#t : Calender. Selected&ate. ToShort&ateString("

-' Te#tBo#%.Te#t : Q%/%/%R Then

;epone. 8rite(Q*ill CorrectlyR"

o To l%

End -' 

.Net Programming (!Sem"

8/15/2019 Dotnet PDF

http://slidepdf.com/reader/full/dotnet-pdf 53/53

Latha Mathavan Polytechnic College Computer Engineering

-' Te#tBo#.Te#t : Q%/%/%R Then

;epone. 8rite(Q*ill CorrectlyR"

Ele

;epone.8rite(Q3)R"

End -' 

l%$

-' count: True Then

-' &rop&o+nLit2.Selected-tem. ToString(" : Qroom%R Then

count: *ale

;epone. 8rite(count"

;epone. 8rite(Q;oom ;eervedR"

&rop&o+nLit=.-tem.4dd(&rop&o+nLit2.Selected-tem.Te#t"

&rop&o+nLit=.-tem.;emove(&rop&o+nLit2.Selected-tem.Te#t"

End -' 

Ele

;epone. 8rite(count"

MgBo#(QCountR count"

;epone. 8rite(Q;oom i already;eervedR"

End -' 

End Su7

End Cla

RESULT

Thu the a7ove program 'or Aotel management uing 4SP.NET +e7 ervice +a e#ecuted

' ll d th t t i'i d