Download as pdf or txt
Download as pdf or txt
You are on page 1of 58

Unit-1

Ql- .Net qq1 B ? .Net Framework d Architectue c{ Features EJ s{$lEi I

Q2-CLRcqr t ? gtrd ord liE rrsqn r

Q3-CTS (Corunon Tlpe System) t snc qlt trrflt t


Q4-MSIL@ri?sq$re-i
Q5- Assemblies and Class Libraries t snc qlt trrfld t
Q6-Visual Studio @I B ?
Q7- hoject cqr t ? Visual Studio i ftroi troR d koject q;lIA qr sod i r qq*qn
Q8-IDE i s.rq cqr Eqfld t I

Qg-Event Driven Programmrrg cat t t Methods, Profeccties 3f{ Event al sr$rEij

Unit-2

Ql- VB.NET i s.rc cqr sqsi tr


Q2- VB.Net i Variable ir elq cq qq+d I Vadable d Declare d€ ffiq qror t r

Q3-VB.Net t Data TWe cqr t qq$r{d


Q4- Forcing Vmiable Decleration i erq qlt sqsd B t

Q5- Variable d Scope and life Time al trrflSi I

Q6-VB.Net i Constant ir er trqgd i r

Q7-VB.Net t Aray q{ i
li,oi rois d t}i i
z qs t

QS-VB.NeI i Contrcl Array t sw er rrsrd t r

Qg-VB.Nett Collection t enc qq1 trrfli Br


Q10- VB.Net i Subroutines ol s(r sRf, qqflI{i

Qll-VB.Neti Fmction ol s< t]Bo rr*rgi


Q12- VB.Net i Contrcl stxcture a) s{fl{i
Ql3-VB.Net i Looping ol trqsqi t

Q14 VB.Net i Message Box clr Input Boxo) sqflI{i

Unit-3

Ql- Window Form qqr t ? gvd Loading, Showing ocr Hidlng al RT$Isi I

Q2- ro Form d q5t Form t dt Control faqr qrdr t I s<r sG( qnEr{i r

Q3-Iifu Controls ol svd Methods, Propedies oe.,r Evert sff, {]qfl$i


Q4-ftFlq ror{ a DialogBox ol trr*qi
Q5- Corfext Mern t qrc cq sqflt t

Prepared By-Nitendra Tomar Page No-2


Unit-4

QI -Object Orierted hogaming t <<r v+ad t gfld li1tq ffirdr( rrFsEa


Q2.VB.NET i Corsole Application ol fffr tuce orfr Sr sqsrga I

Q3 VB.Net t qo Class c!]l 3ffi€ 6l dQ foge tuqt sm tr qqsrqi r

Q4-Vb.net + Constuctor @r t ? s<r sBd sr$r$n 1

Q5. vB. NET + Deshuctor t eirc nqsd- t r Fqsrga r

"qr
Q6-vb.net t Inheritance ol s+ sEo sqsrgi r

Q7-VB.Nett Overloadirgavi overriduE of s<r sBa srslsi t

Q8-My Base and My Class Keyword t qc qcl nqsi t


Q9-Vb.net il Accesss specifiers ol vo Ef6( tr+arEi I

QI0-OLE o1 ffiflsi I

Q- I Data Base Ploglalning {cr i ? r ADO arld ADO i


Q2- Server Eplorer d 6Rr Data f$fl Tola
Q3-Data Bound cortuols i Data oJ Dsplay dS
Q4-Data Base $ wv Corrrection Objecl, Data adapter or use oii Data ol kEert, rpdale aql
Delele od f$ yfuqr oJ sr{r{i r

Qs-OLEDB Ep{r SQLDB ol rqgEi r

Q6. B fii o) srsr{i


(DDataset
(2)Dda Adapter
(3)Corrnand O

Prepared By-Nitendra Tomar Page No-3


Unit-1

Ql- .Net flr i ? .Net Framework d Architecture nql Features ol sTflr{i I

Ans- .Net Microsoft Compary d rl!1 Develop l?,w rrq w oEii+€ t fi ft-€lq ciictl}{ ]l]{=q w {r 6tfl i Dot Net
oJ as6 d Tools nln Lrbra es oI sqf,er oRl-rT i ql i{dqd ol ftsdq rnqeiw d qEo lnqdr rl onr mq $q i fuce
tnsi i slrq {fli t vnq t E-q si{r .frl}.r 1iJ€q w 3nqftd &q {nrcn{i fr C, C++, Basrc gei? rffi.r qqeit or
rqtq oid 3rqit specific Requiement ti sffrR w drc2tq{ fl Frqfq osi p} rsd qrErI rl .sffi'qc oq+r i GUI 4flqq.r
n ftEdq 3li[€,r 1t{zq w 3rc.rRd &q {n,rcnqr VC++, VB scrR ifnfi.r ,.rcr3r] di c+.r ord o.rft Specific
Requirernents ti 3nsR w €iEic{ fl Flqfui or rroi t
.Net f,'ramework

.Net dif{d .Net


A rchitecture

ffiiidl or rrirq osd cftI;l {{i or


Iniastluctue i .Net dirl{d \ro Consistert 3frd€ sii@cs !ffi-r
$'ga ot sc er osar t 1 l {]',]t ro]a d ,rffi{I{{ al {rri d ft{
rEr@r Common Languaqe Specilicalion

rfq ]?q q rroo i


By Default.NET it sr{ !ffi.r a-.Aq lrFqf'df, +fi t nil Applicalion Class Libra es & Soruices

VB NET,C#(C sharp), J#(J shalp) (c'r C++ tifi B .NET s,c s'lr
&q A lAs qo Common ff{ i qs To Common Class Library Ease Class Lib.ary

oJ scdar o{fl t ffi fulr Net ed rri{i qfr fiq i oio fuq qr
soo t s,sftl qq ffi vo .r-o t {st a-.iq t ft-{q s{d t d Oommo't LEngrrage Rfilimg
sd qgo {rffi Lrbraries oJ rM qit srq{qofl +fi dfi tr rcio dds
A ft.r A{d S)ata,x 3rd.r 6id i

Net dqcd d qeo :- Net dn+d d gw sv il an Cornponents dd t

1 CLS (Comnon Language Specificatlon)


2 Fcl(Framework Class Library) o BCL(Base Class Library)
3 ClR(Connnon Language kurtime)
4 .Net Tools

1.CLS (Common Lansuase Specification)- CLS yo Common ff{ ero i u) Multiple .Net !ffi.r a-.nqr n ors
(9n Comporcnts aJ dtie {{aI i Wf lra i Eq E6 soi t fu Tf, .Net Applicatron a) iqcw d qm 3rldrtfi ord ftri
l?fl T.Jtrrd ,ffiq ffir i 1igl qr sf,fl Bt .Net i rdt 3iid€ 3nRPcs nr,rftr {q i$ VB.NET, C#,J# oen C++
seql=dn +fi t
2.Fcl(Framework Class Librarr) qI BCL(Base Class Library) - FCL.NETffi i Class Library tlfi t ftrsi
orq'tlrq it Classes en erq e1sc Eid t El Net apphcations dl vrrdi ol qai cpr ftqi, Erernsr t vflr{r o{i, xML d
rHs o€, arfioo 5ui {el$rr (cUD al r<lifo o{i, Trffi{r a) Draw {G ns,r n4 sfr1{] dr rd{ oG sefi ri 1}.r s8q
qrrfl i FCL,qEd wln 32 API ot 3rcEo I]1:Ir{ r .Net 3i"i€ i Wrap o,rm tt lH VB.NET q ({rer .NET t'rqft,r
infi ti E]n rql.r fuqr q sofl i r

3. CLR(Common Lansuase Runtime)- CLRNET 3lfn rildwl qeo dot i


CLR.Net t {*)AiF{ d ftl fuq=qc
sr=qq +dr t
rE .Net {€[d{I{fl (9,,r 3]ictfur fureq d aq ggs$s oqe tnd oro t d t
4I9ll9qb_ qr Tools rtd t irJ ]?F.€lq !ffinq aJ i{crc d{i d ft.r rct r ftrn qi i +S visual Studio
.Net Tools
.Net qlefu'qe d sRr tEDlid fusr .sr .Net Tool ir fuqor wtq tF.i'tq !ffi{rr ol i{dc E{i d t?c fuq slnl t
Visual Sh.rdio qit ,11 Net Tool d crq it qFfl qq t rS Visual Studio.Net }t sEi i r Visual Studio w IDE(lnteglated
Developme Envirotunent) ot s.roer ovn i sl tqdqtl d Stand Alone MNDOWS Applications o".r ic sffi$q
r(qrR dr Rd o{i Efrqr r<ra E{fl i (9,,r rE Net FRr sN ftri qi lrd ft.In,i Qec;id w {r Eli ir

.Net M S frq{ (Features of.net Framework)

l-Interoperability-Frqqf, oqer lln=r) o) i=n cw grri l€dq+s d Aq n iasf{I.l d .Tqcqf,fl r=1fi i rro .net
d,qqd qi nPr Tlri r+)dv.rs ti rtr t Interactiord elio oro t

Prepared By-Nrtendla Tornar Page No-4


2-CLR(Common Lansuaqe Runtime)-ClR Net ffi d fri Execution Engine d tr t ord oEct i s.lt net
Programs CLR d Superusion i ffi< ili t
ll-ansuase Independence- Net dill{d CTs(Conrmon T}?e Systems)q cftqq o{fl i CTS Specificatrons CLR d
rm rr# fui .ri programming Constlucts nln s,Ji srq Data T)pes ol qR,rlto osor i s,n Slan d ir11q .net
Language sr trir.r d{d ftd ,ri qffi{r 3ii dr .snerq ti fiq i ObJect Instances qil wld o{or t

+Base Class Library-Base Class Library(BCl), Framework Class Library(FCl)o Part t rE .net ffi or rdl.t
o{i qrdr {Jql &M + ftn ,rrF1riildt d crsitr sqf,dr oirfl i BCL N kr+s d sq.Ier oqrft B sJ Common
Fmctions qi Encapsulate tnrfi t t

Ssimplified Deployment- .net dq+d i Mr qH npn q.{ {Fqftf, di i vt oqa* iirciq{ A installation al
+iq o{i n rrrqo tnrd ir er gfqlaq ryi i fu q6 qr} r} Install fti .ri tffiqqr qi Interfere.r=& o.ror t npn {qsr
srq{qofl3ir a't Sltr o{i t r

Gsecuri8-.Net Framework A11 Applications tb liri Common Securty Model o) scrdr o{ir i t

ZEglELillqL Net Framework A11 Applications d liri Porlabrlrty d sfiJ {{(1 t

Q2-CLR flr t ? grd or{ frE ergrrn r

Ans- CLR(Comnon Language Rrurtime) vo Execuhon Envilorunent i qg .Net Language i ftId .Ti cftll nlr
3nrtEq fu{eq d eq i q{ iqq ti rq t ord tnro i, u} ClR(Comrnon Larguage Specrfication) dl gltr rtr{dr it CLR
i Iq qRFl Managed code o) Native Code t o++J tns. rpr ss$ ,r{sll ,lflq al ]ffid oi,]I i
r.+o,lq1}{ &q n ftd ry }tnq qi ssiJ sEEf, Comprler Compile
oEot i dil VbNet Souse Code aJ VbNet Compiler trRI Compile fu+t
qot t ,fS troR C# Sourse Code ol ssd Compiler xm Cornpile fucr
sm t t ffir dl To comrnon language .r.rfi it ffir Il(intermedrate
laryuage) q MSIL (Microsoft intemedlate language) oei i MSIL,
CLR ri 3fl.fd JIT (Just In Time compiler) ti qm Maclnae language v tu.onhon h4B Ru in! lcr)
Native code 0 cig r ti Form t .rea qfr t

CLR d 6r{-
CLR d qEcwl ord FrEtutud i
Lir{dq+< oI ftrqdF-qiyF(Simplification of Development)-.Net d rqJq
tnri $qq 6i GUIDS,Unknowq IDispatch.and Library d znq d {dtEttl
rnqq-r A !lt n qtci d .].rqqqofl {& +fi er s',]t al CLR }.qit ffi w
rqq i-iq oro B CLR +qro i:Mi€ oJ rqq s'qrom i, rsftri .net or ols
3rl!fi !\Nr< +fl t

2- Ed {rr}d net Application d t+eq tnri d liri Iif}q rox d q.< sroer o<ror t, ffi Visual Studlo trgs $c t qdlr
fuql s](r tl CLR, r,r q.1] ii q1p] ffi A or{ o{i dr 3,rrni {rrfl ir

s-Tdtqd ilri-q q+d- CLR d E]11 rdt.T ftri sri qd ilto srq qJqr. .net sRr sN o't sri q6 fr,fo n ftd ,rn itr
a'ts al net oF{EiN d flsr IL (lntemediate Language)i o.v6a t}q qar i oq .sAlrr +i d wq< ILA {rPr Metadata
slidf,e ,Jl fu!,e a qar t d q6 .net ERr sctd o'l qri Erm q(Ifi ffii tb cm ,JI rfll{r 1iq q socr t gsor 3rq i fo
.net sm wH 6t qri 4fr w it'{q n ftd ,ri 3ffi€ al q{fi eq n r--iRc tuq qr s+or t id \/b.net i ftrel .rfr
.am ol C# t g+iRe og rroi i

QICTS (Common Type System) t qrc Eqr €{sri t r

AnsoYqc fuEq
"rgq
.Net Framework t
Common Tlpe System(CTS)ro €Esg Speciff oro 1a dS oqer i.itfii d T)?es t i d
Specific Value avr Tlpe Defirutions fuql qn d ffi€ t
oiqc edc ftJ€q cRrfllia o{f,r fu CLRi tlpes ol dd i
Prepared By-Nrtendra Tomar Page No-5
kw, rqlq opr tis fuq qro i rw Cross language rntergrahon d Iid sc qJq d F.rld or ,1) ro rre{{ .n-r i oiqc
edc 1t]=q FrEfafuf, $RlTs o) qqqfq tnEor i
r so ffi a) erfif, orot i d Cross-Lar4uage rnteglatlon q?e safety (s,r s4 Tid{n<r A oJs execution qil rlero
ccri rrerqf,r orot i
ii
2 c{ 3iid€ siiMcs risd o} s.r er orror t s} qo wtt Languagei A E*f ffiirlr ol s,ilJ o{il t
: s6 si Frqd ol qtirlto tnEor i furo1 o5w.r ffi ol tns.]I srlti 3ili qr rE SliRad ori t sarqo tnEor i fu
llE filE irfttrl n ftd .rn 3fid-Es w {st d spr rewe os rroi t
+qa erlsifi al sqdal .rlKrr i E) Primitive data tl.pes dd Booleaq B),te, char, irrt32 oqr int-64 iiqft a) rsor i r+or
rqtq cffinq t-rd.rn€ i l}q qrfl i I

Common t)?e System b?es i6l d q1qlq rltd ot e.rH o{dr i


(l)Value tlpes
(ll)Refererce T)?es
(I)Value Types- Value b?es 3rqi sq al roi t er Value tlpes d Irstances oJ q d Stack T{ Tdf,d ryi
ssffi
i v w rz-a* il rdine qcif.ic o{d Value Tlpes built in user Defined a1rd enumerate dt qai
t t
(Il)Reference Types-Reference Tl.pes, i.{
d fuffi \err d Reference qil €R dii nln Heap w T#d 1ii str i t
Reference Tlpes Self DescdbiE q?es pointer q?es and intedace tlpes rt {rot t
Q+MSIL €r t ? s{sr{i I

,A.1$-MSIL al firlo r,,c i Microsoft Intemediate Language oei i r g,$ MSIL Code d c[q iI ]t sF q[fl i Lnet El{r
{]tr 6l qi 4rdt i[.Aq t ftgr rul {]H o]s net iriErs{ -i rm o+qd fuqr srfl i el sH ats al MSIL q IL ols t
tn+sJ o{f,I i q6 Ene€]1-sr]e ois rto t cer c6 MSIL a'ts PE File i ssl slfl i r CLR o't lrErqdr t JIT A rqh il s{r
MSIL a'rs al llflr drs n oqqd laql srfl i rE CPU Indeperdent rnstructiors or go ite ao t s) .net Language
Compiler d rm o++J tuq qo t .it rN q;)s ol MSIL {{d t?,q qror i t, Et CLRA flI1 fiir{r f6q qldr B ql JIT
oqgs d q[{r g,r} Nahve code t Convelt s\KI t
CLS.MSIL A fti Intastructure aJ sqf,q rril1fl i MSIL A trgs flr F]Efifuf, i
1 MSIL, Languge interoperability o) scdel E{dr t

2 q6 1].fi .net Language d Iid qo ffi rcqi{i{ o) scder ry(r i r

3q6 Flq Flq Rutime etrvilonments d s,rH s{dr i


a CLR s$ 3nq1+ il {]rrflf,r i, onr JIT a"n'.r{ d Errr Native Code i oq+J tnEo i

Q+ Assemblies and Class Libraries t qq flr qTfri t I

Ans-.Net Flamework tb fui \dd?r{{ o} {fld i ss.i Assemblies ego r.req,i Role o) lirrfi q{ Assernbly
q1p] 3nc
q{ q rfi ir e'fiq F t ftf,s{ {{t €ifi t, o:r fur1 T),pe Defifltlons ard grrd ersw d gde[r d rql d r"r i
-dr
rde dfi B w Assembly ffi assembhes tb References qit .il {s {rf,fr t w Assembly r+ir 6iet sFe +fi i
lnsor r+l vo \€d!Iq ti Versron oJ cft!.rlia @{i d ]iIffi i w Assembly or Version T)?es (?n {{]f Mq d
Version oJ Be{qsi ow i r net ffi w fi qeii w w Assembly d qodlqa Version d fuqrqqr d 3r{qid i.r i
Assemblies,.net Flamework t rdrq o't qi qfr rffi.r or n*nr qr tlor tr Assembly fi1t rw1q a't [idd o{fi t
rqs sn oJs or {q+r B ffi CLR s{dr t MSIL(Mroosoft Intermediate Language) code q{ PE(Poftable
lffiqd
executable) File i rlcr i ffi<f, {dt 6tfl i qR q6 Tfi Associate assembly Marufest oJ +oil rqor i
L q6

2 q6 rfi E!fl riq ol ylss orfi i r s6 vo Assembly {Te i liq w Pennissrons ol ldq= q-s fuq qror B

3 q6 ro Ttpe Bourdary oJ Form orfi i t rcio Tlpe t6t identity il Assembly or ;]lq qFqfird t

lift fu, t c{ Assembly d ver d r<Rfo fuq rur i Assembly


f,\{-",lil l
fo,--"d* l
slqlqf, Assemblies d qox o't dtdt t
1-Static Assemblies. f-r-"".__l
2-Dyramic Assemblies
l-Static Assemlrlies- Statrc Assemblies t
rct Framework Tlpes i fr
Interface, Classes gqi? (q,T Resources
qeqf'dn El sf,it Static Assemblies, PE File Bss w i
+fi di t
2-Dynamic Assemlrlies Dynamic Assemblies oJ net Framework or rdt.r ord llye ffqr qr {rfifl og,,l fuqr<qq i i
n ad fuw w tro +& d+r B Dyramrc Assemblies d
fuqr<qc d !qq( fuq-a w trq ]?q {]oo q i
i
Assemblies Flqfufuo Parlies ltoor dt €ld'l t
! Assernblv Manifest

Prepared By-Nltendla Tomar Page No-6


> Metadata
> MSIL

QcYisual Studio flr t ?

Ans- Visual Studio, ql -oHqc aqfi d E{ iqcq fuqr.rqt q;n Interglated Development Envilotunent(lDE) i F-{rfut
gS Mrcrosoft visual Studio til oti i Vi al Studro or cqlq Window Form Applicatloq Websites, Web Application
Web Services gcql? ol i{dq d{i d ftd fuq qldr t s6 Console (sr GUI EHr 6 d ,rffinr qit i{dc oG A fut
rfq fuq qo i t qs Micorsoft Mndows, Windows Mobile . Net Flamework seit qrt os6 d Platform oJ wH
a{fl ir Vlsual Studio t w ats (trsi-i nFqf"rT i d Iftellicence (9,,r Code Refactacto ng oJ slld o{(1 ir Visual
Shrdio liFiq tr{Ir dt !ffi.r d{q +S VB,.NET,C3,J3 si]qrR d rid ors sR"r (!.r tuqllr dt sffiSo oJ sqrer olrfl
t
Visual Sludiod sTs ff
"F5't i
l-Etg qfgfi -{€f IDE a't flE Visual Studio i qo ots cfu-{ sFqf"rT €lil t qJ Intellicence or vql{T {{d Syta\
hgNighhng oe.,I Code completion o) sff oEct t
2.B{rrrx- Vlsual Studio t w Dabugger ttFtfio tlot t qJ Sorucelevel Debugger er MachineJevel debugger <H d
$c t ord o{il B
3.Mrr-visual Studio i l:iiql.t'{d 4r w Et{,e l]Fqf'dn 6rf,r i fu{fl r{irq {fr.l d ffie n fuq srfl i {sd r{s
e^<l FrEtutua €ri i
(I)ttr€tq ,ri{ ]M.{i
(lDwPF Bs1gri
GIDnqMrr/ffi€
(l\/)q.ilqMri
a.lfrrr fgqr$ r Visual studio t Desrgner Tools d .].ftftfl qst Tg{E qw FEftfud t
(i)3n[r 2qr flsqi
(n)rfcfiq sBer
(in)o6€ flsrf,i
(iv)ifcwr qflrErqr
(v)dlq qflr€lir
s.gffiefuRfua ftgo.a r@ ffi A futt{{dt ql.qfl3i ql erqdr3i d liFRq a fui Etensiors o) ftx.qfto ori i r

.net Framework d l?l{q Versions oJ Ftqftfud Table i tr<Fro fuq rut i


Product Name Supporled.netFramework Versions
Visual Studio.net (2002) 1.0
Visual Studio.net (2003) l.l
Visual Studio (2005) 2.0
Visual Studio (2008) )o 10 15
Visual Studio (2010) 2.0,3.0,3 5,4 0
Visual Studio (2012) ?o 10 1515

Q7- hoject et t ? Visual Studio d ffi ron d


Project Ti qr Eri At rr{r$i I

Ans-fl',e qt i --f,r o )e, \r cqeF aE+-


Pane t IDE(lntegrated Development EN,rronment) d e1p]
qo .its d s.r n y<1ifo €ri i 3rqd 1iq3rd {qtuit \.rrdrdsa
3Edt G=q
appd4 rdGhn r.ptdm
mdq--{r A fui +s A i{<.fu s.drr 3rd.rNodes,Event, logs,
i
Filters oqr Macllllres atd rq ro of viie w {jiqni
Add or {roi t q rn i e'fto ft{3rd q@ ol so
Single solution d rlnl Combine or sod B t

iffie d er{qr
Iig3rd {qtd n tutq d'H d orux w ol o<s d mde-s -
sFqfcfi +i i dS Vrsual Basic, Visual C#, Visual J# laFoErb'€ Ea4p Gr4N6iwid456adqtue(MrF44o{r,
EerFq a-.Nr d 1ii o{ are d di<tl qFqfdn di t. fr
6q 3,-qil qrq{qof,r d g<s. trIjm tns qoi i r Flr-fafuf, fu, f ( l ."d I

Prepared By-Nltendra Tomar Page No-7


i Visual Studio d Iifilq Tlpes d rHe o't r<Rfo tuq qn t

Q&IDE * qrc Er rrqrrt t I

Aff-VB.Net IDE inbuilt Compiler, debugger, edltors, autornation tools r] ftoor r+ dor B VB.net IDE ol Visual
Basic .net Integlated Deve;p[,ent Enviotunent trEi i t 9d q{ {i !H€ a] 3irr oG d -rqq( qffs fuqr qr s{dr i t

VB Net IDE i fq or. drdto ft"iil ci{ E9.isq {iqcr ctrwtir sici? sFqr={d Etd t ql VB.net i \€)dlrr aJ iscq
osi i mrro €ti t
VB net IDE d ftFlq }rlrr F!-1atuo di t

! t{r rI{ - Vb.Net o} staft oe d e{EI( Eq Staft Page a't iqi i + Proceed ori d 1}g 6q menu Systern
or rfqori i menu Systern rn{l gamsx Selection ol Charge ori t i$ Project Menu 16ltemsqrJ
[<riff, otqr Solution Explorer t iJ qii 6q rfi ,ld€ ol iaf,e o{d i d{d a Items r(Rfu oEcr B File
Menu tb rro,lo Submenus dl List dfi t s,S q{r{ i-{ aR w 1il}E Menus rld t cp.n r+d eio.lo Submenus
drdtr
2. Ed qlt ! IDE or q{r!I Feahue qd EN t w IDM i Top w dor i r qg <x i rcPlo ea< Task d go oG or
Sho cut Method scdq oqri t Tool bar menu Items aJ Select a{i ot qo Quick Way sqf,q oli i t dS
.I15a o't save o{i d liq Standard Tool bar w r<Rfo Save buttenw faoo o€ o't errc{qafl +fi t
3. Ed dfffi ! Vb .Net i Tool bar tn rqlq qo {]pr oJ orqf n W o{i -i ftIc Buttons Provide oror i Tool
bar Slan vb.Net oI rEcT,l Feature i r Vt Net i Form ol ftq .sq o{i d 1i.l 3,rq{qfi Buttons 5-(] Box t
sqd€r di t di Te>'1 box , Cornnand buttoq Label , Check box , List box gqfi qa {qtl d Contents
qi Divide o€ A fun airn &o ot rqlq oii t Errt i Tabs ,Marked ,Data ,Components,Mndows Form
cpn Ge11eral Tabs oq troz E)d i t

a. dfqyrn \.fiE)-{i !
{n.WE cNFrlr ftd En {n.WF d over Vrew o) if,r i,ffi s1pl 6qoTdoGirasn
trdq3r }t 1]Fqidn €lil t q6 Tool w Hrerarchy o) rctilo oror B1
5. itr&q fE 6) - vbNet i Prope y Windows Vb d orE fi trdq a'l qrfr i (9.r r+t q& Featues
sqf,er o{rfi t qqB Vb.Net i qq 6q qrd a) fufl .rrr o{d t d Fonn w 3,-c{t irl,c Dm{,nq Fr qlFr i il
Conhols ot ydtq ord i g,c q.i Contrcls d Property Mndows i r<fito ttfi t t 5 Properties ol rr cvi)
{6Et]l{ q(d rroi i Cureltly fus oSla d Select ori t Prope ies window q] ss oqlo a't Propefty
r<riff, €rfi i
6. .nserd &t.S :- IDE d Bottom i 3rscge n:n Break Points Mndows d lil Two Tabs M ii i Break
Pornts Windows t Break Points Manege ori d Sfun r<rc o{et i t qq frflq Execution Halftlor B oq rr
3rvi ats a) Debeg ord t sS rcx qwege ftl,d Buildmg nlr Rruming Programs d Results o) tot t
7. dfife rrsqt :- efide qrsq{ qr v{]€ilr w oblect d ert r<it d list ol r<Rlo oro t dt sqoel 6li i
3fd€ rflr€lir dr EH d Ii(
View- Other Windows Object .e Lb-ryrF"- M*fr M-. !e.rAd-"fr-r
Erplorer w Chck ord t oq fu€ .:l.LJJ-]Jr, 6J.:: ' '.:.r t , .= : .'! J a ,r il n , , t :
qw€tw r<Rio +dr B 3fid€ i-h :-i k-L-rh, -^p* .,
,=
" * -r.
qw€tw flt ctlnq a qff 3f,d€s
ol r<1?lo oro t oln s+ i d qt @ tro --==41 .:r;.r"b
qa ra i sEri vds oG iar B
8. ot*re tA :- Contert Menu liBq
Actions d qil oG Ea ftg Conte\1 ':,:i::-. -!{ ----+ """ """ I

Menu oJ rscr i Contei Menu d


stdi A ftr sfl object w qrs{ or
Right Button Click o€ i lirS eq : Moi+n6 ,

rdrq oq € t rtro't Speciff List or


Shod cut r<Rfo rlor i
9. ffie qfrdrt ffi :- qti€
q{I.itw ftsd n {drlq frd{c t rr,lt'{
cpn Modules dl tirw ol r<Rfo o(or 1,1t!y4
t r rirn fii< wqo d s.a.fo ,nd er
{fld ffi{rl ol Rqt+t .nr i e-S o16
gt]v wt' ,jt s-str,NE i qtsr sl
soor i qo lB{c ql Ed i fuqI rur eeon qr€t wr.ra d y'fiio oror t

Prepared By-Nltendra Tomar Page No-8


Q9-Event Driven Programming 4tT $ I Methods, Profeccties +{ f,ventE} mgr$l I

Event Ddvend q{ fu q.qi F"tq dfir fu sd ltqrq d {lE-r ssr o{{r i? s6 sq-s qei w lfuo {!;fl ql.fl
i qr Text i
i
box Ten ol Enter sFr qEfl q t
s6 \€tdirr roio or+d ql.f,r i {fl {{n
6 d nlq l}q 3nltrFn qn 3f,)d
tnsi o't san seo i
qo s,ic, qd 3fd€ iJ {rqF{a rlo t i
cE rfi qe.n sl qrt d rwrc o't +sr il d {rrq qEf, ffie
ddl t +il o't dld w yo o't ol eqrcr sr qrs{ iI fa.I{ orcr tflIft i
'dc Eq vB.net w ftF€lq lFiAyI.l al rqr o€ t
cl rq cf, Default Form oJ ffi i t t i t
sl IDE roz arm qroq rs Fo1m qdRl s) Form Class system .windows.
Forms. Form tInherit Etfi i r d{
fu FrEfufuf, futr Fonn I d i ff1q d
srtlct rql B
fiig-<l o"n rn--s
+aE VB net it cfivlrr.rs of Tl1 ori d ftd oJ ron d ic.s{ dri e-sn t t llg
n"{s-n Fr.,nrirq{ t
Method Descdptron
Move s6 iars MDI Fo1m Form u Control o) 1r tnro t
Drag qa iarE Line, Menu, shape, funer and Common Dralog Control d qliR< Iiffi aControl d
Reftesh Dray Operations d {s tnrot t er< o,rm t qt Cancel oro i
Set Focus qc iers qo Form w ot'a d Reparrt o) T{I oror i
Z-Otdet s6 iars Specrfied Control and form d Focus Tr itrEcr i
sE tprs specrfied MDI Folm .Form qr d€Fr d srqi q fu A Z- order ol.qd+o d+a d
qPr rr.,rltf, o{ar i
Event T{ ritiRl;l +f,r t d q"[ d{ ur oQr'a rm Recognrze ator i VB.neti gq s. t FlFftfuf, Event or cqlrr fucr
qo&
Iwe Event Deoctiption
Key Board Related Key down kenrp rEe€(cq{€AdrAqcdNw
ftxn o'l ot <qi i r

KeyPress
qr sie nir qr€ rJor t, qc 6t !N w
Mouse Related <!d ,rff 6t aJ ffis o{i i
qesic aq qr€ dor tqq d qit is
r

Mousedown
o{i i
rE eid c.r qie Etfl t qq qss ti
Form Related Mouseup ceq srrr Elf,r t t

lg sie oc qrle erfl i, 'rc qs{r qd.r


InitiaLze ol ,rqro{ M)q s{i i r

Load lr sic qid d q.roR aJ {qddr t r

Resoze lr sic qid oi iqrff i ots rtrEct i


Actovate qE sic qi{ d }.l{R al {sddr i r

Deachvate lg sic qi{ ol {fizid {ro i r

Query Unload
rs e,ic qid fut ol ffie qEor ir
Control Relafed c6 effi'd al Mfi t ftTr s{dr i
Telminate qr sic qid oi effid o{dr i
Unload
c6 eic ff oi Unload {{(r t
GotFocus qE sic aiid{c aJ ffis rtrrct t
LostFocus
lt sic and{c qiros d qo tnro t r

Prepared By-Nrtendra Tomar Page No-9


Visual Basic .Net

IInit-2

Ql- \ts.NET t qc qI nqlrt $ |

Ans : - Vlsual Basic.Net q{ Gffi€ 3irl@ oqzr fitr|Fm ido t fui Visual Basic d Tercc d $r i iq qr so<r
i Visual Basic.Net o) Net iir{d w sffii€ fuq srfl B
Visual Basic.Net aJ ql{*Hqc d cr{ Bqr .sc fuq .rq i r Visual Basrc ir.iq or fu<nq osd sd .Net ffi q{ sdtie
fuql ruI i, s*]nr Et VB.Net o6i t VB.Net i Mndows Form AppLcatioq Windows Service, WPF Apptcatlor!
Corsole Application rcul? o) Net i,qcd w $qeq fuq qn1 i

VB Net q{dq t 1R .Net {(bT{s. ftdq l€d{rn. nq tffii1T{ ns sffitff ,.qrR d i{crc d{i d ft{ tuq .rrr
fuql rur i
rssa i Visual Basic 6.0 d ffiq f$q ryr !n, q6 i fr frg.I{ E}n e{ri ADo(Activex Data object) d rqlq d qm srar
rN qjt fure osi ner t+q tnd d qt t qRqq ovq .cr s-ei rtqE{ al ASP(Actrve Server Pages) or wh ord sra
ns 3ndqz]r n qflts oG o'l !fu{ al sq.rer .r{rl]l Visual Basrc 6.0, Visual Studio 6.0 i sltqfuf, s,r Fetnrary 2002 i
qlrot{]rcz i i .Net 4q{d w 3nqRd ftrelq \ffinl a't i{dq s{i d ft.r VB.Net ol lHIq fuq Visual Basic.NET ol
qarq Version VB.NET 2002d qrq tffiq fuql rFr q6.NETFmmewolk l0w{;ls{fl B ssd lqqld VB.Net 2003
al lHlq fuq .cr, rE .NET Flamework 1 I w rc o{dr i r eE IIfq erqn vB.Net 2005 ol fu)q fuq rul d Visual
Studio 2005 i {]Fqftf, qr Ii 1i Table i Visual Studio d Versron o'l .Netffi Versiors d r q rqRf( fuqr.rq1 i

Visual Studio Versions ,NET Framework Versions


Vrsual Studio.NET 2002 1.0
Vrsual Studio.NET 2003 1.1
VrsualStudio 2005 2.0
VrsualStudio 2008 2.0,3 0,3.5
VrsualStudio 2010 2.0,3 0,3.5,4 0
Vi$ml Strrdio 2012 2.0,3.5,4.0,4 5

Q2- vB.Net t Yariable t qrc @r €{sd I variable 6l Declare d-t fuqr qrdr t I

Ans-iRc{d ariables qo iRr'.ra srzr ol €rs osor t ql

d rffr lNrs Eter i w ltflrq, {tzi-drr a't fu€ €ldr i .i nRqco ot n{lsie oror t Erfi rffir d+e d r<e
VB net i fl q{ rtqrq d fuqEqr n sqq nRcq.{r n.W d €R s{i t qd AR!,sd q{ +r a:.r w tqd roor tr o.o
nRqtra o"aer o'l itit{t or rdtq sRqr d(r i

VB Net t Rc{dJ al ffiqs orrr


VB Net i iliccd qi ffi o{i d tut Drm d-e o} rfq o€ i fiil
Dim a As

Dirrl Dimension or short sc irA iRs{d r qrq i n!.I Integer s-s tRq{d d sEr or erJc i sl <rffl i fu 5,{r iRrFE
n r&w iq o) rit< or+ i

ss r$-e d sEsrr a iRqqd t ro i"q qi lst5r fuq rul t


Afr}atr i{r
VB Net t iRs{.{] al Mqs ori $.ru Frqf lfuf, riqir d sqq +{qfl qBi
Prepared By-Nltendra Tomar Page No-10
1q6 2s5 Characters iI oq i Elfl qlti
2 Space d 3Eqli {S EI+ qBi
3q6 cfi {q{ il {F {S 6lrr qrEi

4period a'l 3raqli {S El+r qiti


F[qfufuf, Table i Vahd apl Invahd Variable Nemes + s(6{"r a) q{rlqr .]q i
Valid Name InvalidName

My car My car

Year lYear
He & His Father (*&is rot acceptable)
Lons Name Car be USE

Q3-YB.Nett Data Type fir St srsrli I

AnsVB Nett 5s sc ir F]qfuRco rorr d ser qjw or rdrq fuq qar t


l.Numeric Data Type- Numedc Data Tlpes{ fl6 A grer or edw i qJ Numbers r) 1}oor qi +i t e{sr rjr.r Add,
Subtract, Multiply, Divide c.qrl? sJ 6d {lq€d 3ncw A flE sq d sqr oG A ftn o{i t Height, weight
Etc. Ex.- Nrunedc Data Tlpes .

VB Net t qd Data T\Des oJ l?F.rlifu( Table t nslih l6q srfl i


TyDe Stomse Use

B)4e 1 B),te It is Used to Store Posltive Integer

Interger 2B),tes It is Used to Store Posrtive Integer

Long 4B),tes It is Used to Store Long Integer

Siry1e 4B),tes It is Used to Store Floatng values

Double 8B],tes It Can Stores Largest and Smallest


Magnitude ofa Number
Decimal 12B),tes
It is Used to Store Floatng values

2-Non-Nuneric Data Types- Non-Nunedc Data T)?es rE Data Types 6li i t lH rtqed .].ptqEo eiirw oI rql.r
did nffiz {tr fuq qt l]oot i t Non-Nmerlc Data Types Te>'1 and Stmg Data T).pes, Date, Booleaq Vadant date
Types t ltror r+ €lct t Non-Nurerrc Data T)pes o) Flefifuf, Table i trdif( lqq rut t

Data TvDe Storase Ranse

Stmg(Fi-xed Lenglh) Length of Shiry I to 65000 CharacteN

Strirg (Variable Length) Length+10 B},tes 0 to 2 billion Character

Date 8B),tes lZ-lan-2014

Boolean Obiect 2B,,tes Tnrc or False

Prepared By-Nltendra Tomar Page No-11


Variable(Numeric) Any Values as ;arge As Double

Variarf(Iext) Same as Variable-Length String

Ex-Open Visual Studio ard Select New Project as Console Apptcation and Write the Following Code, and Run the
Proiect you will see the use ofvb.net datatlpes
sub Main o
Dim b As Byle
Din n As Integer
Dim si As s ingle
Din d As Double
Din da As Date
Dim c As Char
Dim s As slring
Dim bf As BooLean
b:1
n: L23456'l
si : 0.123456789A1234566
d : 0. 12345678941234566
da: Today
s : rrMerr
If scriptEngine: Then
bf: True
Efse
bl : Fal se
Fn.l T f
If bf Then
'the oath taking
Cons ofe. Wrile (c & .: s & vbcrlf )
Con s ol e - Wri teT i ring on the day of: {0}", da)
Console-Writ s erious ly" )
Con s ol e-Wri ine ("Lets see what happens to the ffoating point
variables :" )
Cons ofe . Writ6 rrThe Sinqfe: {0}, The Doubfe: {1}", si, d)
End If
Consof dKey o
Fnd SULJ

t qc f,r rrqdr tt
vB.Net i 6F co }\re al ffitrl d fid
oG d lid Force or soi i | {{rd ftd static
ord tr
Shrdio and Select New Project as Window Application
and and Dmg and Drop one button control into form and write the code
into br ton click arl see the result

Static iNumber As Integer = 0


iNumben=iNumber+1
Me.Text = iNumber

Prepared By-Nitendra Tomar Page No-12


Q+. Va able + Scope and life Time 16l lqTgrfq I

Ans-iRqrd ?rt rs)c q!{t grfu erEq -,rfrrr or n€l=l +fl i


qr diqqd qn is soor t
cpn iftgde os so(r B qR
co nRc.r.r d nr{iii n ffiw
fuql srfl i s), specrfic ctfrq{ t ats d{d se nRv{d ol qdrs o{il t 3rlrld s6 iRs{d
,rffilrr d ft^n wt lmrqi t Exst qdt oror i qq iRs.E or l.olc, cfi !ffiq{ (f, fifif, 6lf,r i r, d t$ Iocal Variable
d6i i

Ex- Open Visual Studio and Select New PloJect as Mndow Application and and Drag and Drop one conhol rnto
form Show in Below Frg write the code rnto Each button click and see the reflrlt

Local varibale
Private sub Buttonl Cfick(Byvaf sender As Syslen. Obj ect, Byvaf e As
System. EventArgs ) Handfes Buttonl.Cfick
Dim num1, num2, resuft As Integer 'L,rcaL Varibale
numl : InputBox("Enter Number 1")
num2 : InputBox("Enter Number 2")
resuft : numl + num2
Fn.l Srr|)
0",a" I
Private Sub Button2 Cfick(Byvaf sender As
systen.object, ByVal e Es System. EventArgs ) Handfes
Button2 . Cfick
Dim num1, num2, resuft As Integer
Varibafe
numl : InputBo:<("Enter Number 1")
num2 : InputBox("Enter Number 2")
resuft : numl num2
End sub

Private Sub Button3 Cfick(Byvaf sender Syslen. Obj ect, Byvaf e As


System. EventArgs ) Handfes Button3.Cfick
Dim num1, num2, resuft As Integer ' LocaL VaribaLe
numl : InputBox("Enter Number 1")
num2 : InputBox("Enter Number 2")
resuft : numl + num2
End Sub
Glollal Varibale

Pubfic Cfass Forml


Dim num1, num2, resuft As Integer '!+Lobal Var ibale
Private Sub Buttonl Cfick(Byvaf sender As Syslen. Obj ect, Byvaf e As
System. EventArgs ) Handfes Buttonl.Cfick
numl : InputBo:<("Enter Number 1")
num2 : InputBox("Enter Number 2")
resuft : numl + num2
End sub
Private sub Button2 Cfick(Byvaf sender As System. Obj ecr,, Byvaf e As
System. EventArgs ) Handfes Button2.Cfick
numl : InputBox("Enter Number 1")
num2 : InputBox("Enter Number 2")
resuft : numl num2
End Sub
Private sub Button3 Cfick(Byvaf sender As Syslen. Obj ect, Byvaf e As
System. EventArgs ) Handfes Button3.Cfick
Prepared By-Nltendra Tomar Page No-13
numl : InputBox("Enter Number 1")
num2 : InputBox("Enter Nunber 2")
resuft : numl * num2
End sub

iRq{d 6r Er$rdEq

nRqeo zdc .!.r {qi.T A qp{ w


Life time o't {qd t, sl w
Period €ror i, ffi m
nR\'{d qq{t ol {sA iq t
Variables qJ Pubhc sc i ffifl
Eli .it i
cfrirq d drjrersq d Exist ori ld t
Local Variable firffw q Dim and
Private d"z d spr ffiw
ftri qri t. qq i
(o !Hq{ {adr tr oq ffi {6i . fr{iq{ sqtw Elf,r .) Local
qq i i
Variable o't Existance, sqr.( €l qfr apr g+ tqffi? a't .rff Hr{l fueq ol ,{qs €t qrfi Sarne tgr da ffiu* d
i i
fuql -n qefl s{r Case Local Vaflable gr, futc Iid qri t
.!r gr EiiRrqdr'q ftti Eri i, 3ro Global Variables
i
oJ Form and Code Module d General Declaration Section Public {tei-d d q1p.r fuqc o{dr ara't nq 6l sq ar(r t
i i
l?xtr fi ,Hq{ ftffi Form qr ots .iq{d n d+r Global Varialbe ol qdr+z rm oq (od fifi
6ff +fi ffiq i
qq oo 1* firq q< +S r) sror i r

QGVB.NeI d Constantt flr €{sd At

i ftq t Corstants d iq rlrr


Ans-Constants @I s'pJ Valables d sc E)i d sqq w {S c<eft t Constant al
Mw o*i or rt6r FrEfufud se t dfl t
Const Constant Name As Data Value

Ex- Open Visual Studio and Select New Project as Window Application and and Drag
and Drop conhol into form Show in Frg and wdte the code iJrto button click and see
fhe reslrlt

Const Pi : 3.14
Dim area As s ingfe
Dim r As Integer
r : TextBoxl. Text
area:Pi*r+r
TextBox2 - Text : area

Q7-VB.Nett Anlay@r t di ir
? ca ffi ron d
Ans-ll-q{ fi 6dsrcr erJc o'l nqq A d}€le d tt o6i t 1iffi m ffir &q n srq o't r$sorid Iid tt qo
€-sd seqs t cfi iRTqE qfi smgle tc{ a't €tq os soot t qqfu tt q{ zrfr d srq d ie o't rJr oq rroor t
dd int sa1ar53000

qd'w salary w iRf.r.r B qE c.[ qk dI Salary d rjrt oro i, dFoc qR 6q 0 Employees dl Salary ol €l* or+ 1

qEi i d aird ftrn Eq ro iftcqd ol ffiqi o{d t dS Salaryl,Salary2------Salaryl0 dfu< r-sor g{ri1 fusd t fu Eq
qo tt ol ffiqs of a:.r sflor srze 10 mw ot

tt of ffict orcr VB.Net i iRcqd d fl6 A R al Drm det-c oI lqtq o{d ffi{i d{i i
dS Dim Sal(10) As Integer

qd' w sal tt or flq i u) ro iqv o) €te oror t

Prepared By-Nltendra Tomar Page No- 14


tt or Index 0 t gs dor t3refd sal(0) !!rq qfu o'l Salary d rds oEor t r (9.r sal(g) <{ri qfu dt Salary o) rtl<
oror i
tt d rox
qqrqor tt <l coR a'l Elfi t

r One Dimensional Arrary

2-Multtidimensional Auary

1.One Dimensional Arrary- i tqv Sequentialy sv t rd* dfi B, 3r!{lS s'trn r-dimensional
One Dimensronal Arrary
sc i €l{ d+r t By Default Array one-Drmensional rmr i rifi B

2-Multidimensional Arrary-Eq 6q sq oJ Row opl Coumn tetsorcr sraii a< Multidimensional Arrary or
rqtq oG i Frqfult( fu, iii Two Dimensiona
Frqfifuo lla Dimersional Arrav o) <qfat qqt
TTqI

San Fralcisco 75

America 85

Erylish

sr+nrF-6 tt
tt ol qo qr fudqs o*i d cret1 qii 6q s{ tt or size gi {dl= qrad ir dt tcr o{ {roi t {s n={6 d tt ol
D),namic Arrary d fuqd ori ti fa.< rq r* srqq $. t Dlnamlc €-!-e or rfq ord i ifuq Eq g'fl+'l Dimension oJ

Dim D),namic 0 As Idegel

q< i fiqlq i qq 6i q6 qdr ?d qrflT B f* 6q it i ftri Elements oJ eh orcr sl6i i r qq ReDim rlei.e or rfq
ord tt d Dimension ol
ReDim D),namic(User Cormt)

Ex- Open Visual Studio and Select New Project as Mndow Application and
and Drag and Drop control rnto form Show rn Fig and write the code into button
LrB.,i _
click and see the result

Single Dirnmensioanl Array

Din a(10) As Integer 'Singfe or one


Array tsh;t
a(0 : 100
a(1 : 200
a(4 : 300
: 400

ListBo><1.Itens.Add a(1
ListBoxl.Itens.Add a(5
T i slBoxl - Tlems - A.l.l a (4

Two I)imensional Arrav

Din a (10, 10 As Integer 'trjo Dimensioanf Array


a(0, o : 100
a(1, 1 : 200
a(4, L : 300

Prepared By-Nltendra Tomar Page No-15


a(5, 0) : 400

ListBoxl. Items.Add (a (0, 0)


ListBoxl. Items . Add (a (1, 1)
ListBoxl. Items.Add (a (5, 0)

End sub

Three Dimensioanl Array

Dim a(10, 10, 10) As Integer 'three Dimens ioanf


a(0, 0, 0) : 100
a(L, 1, 1) : 2AA
al4, 7, 2) : 3AA
a(5, 0, 3) : 400
ListBoxl.Itens.Add a 0, 0, 0
ListBoxl.Items.Add a 1, L, L

ListBoxl.Items.Add a

Dynamic Array

Dim DyArral25) As integer

ReDim Dytura{Io)
ev
Q&VB.Ncl t Cotrtml Array t <ilc flr €cgt * I

Alqo-{r ttcontrols . ,riqq B. m frqrq erfioos srdr tr o-cts tt eiw one


Dimersion Anary d rq i ru} d .,rfi i t and Delete loq qr soo i r o$a tt
Controls d tql d i-sa o*i or vo gfuiro+o oro d wtn d 5r oror i r

sql q-Iiqfufuf, s<r i"r t Radio Button tt d tc i trd.r ffisl


rur tr ci w Form ol fucc oG tr er lmo oG ir c<Rf( ots fu t
Radio Button ol {i er$q w Contol 6G d ftrn FlEiitun d.q
dAddoGi
Dim rb O As RadioButt Array
Dim Array ze As Integer : 5
ReDi m rray size)
For i &rray size
New RadioButton
: "Radio Button" + i.Tostrinq
rb (i).top : 2A * i
e. ControLs . Add (rb (i) )

Esd o)s d c< oG t. ap.r F5 keypress or$ Form ol rc q{i ir r<Rlo snsege pi{ w lM {-{ o-}d
.tt d r. ddf
Q9-VB.Netd Colection t qc wr sqsi tt
Ans-Visual Basic .Net Collections t$ data Struchres e) fu Dfferent Ways i t io ol d* w DlIerent Type d
Operatiors Provide oti qt oJ rox d Operatiors Provide o€ t v) fu Array
B i Available {& di tr \rb.Net t
gqo: cqrr d CollectionEli t
Arrayl-ist

Arrayl,i$:
Prepared By-Nitendra Tomar Page No-16
Arraylist Collections vb.Net i Available vo Power firll data Shucture t ra Aray 6) a<e fi Multiple Elements qil
Mairrtain tnri d gfitr io t w Anay t Data Values d crorff t Add"Delete,Insert,View d lis Methods Provide
oro i sc{i ftffi,1r Locationt Data oJ Insert fa=qr qr {r{fl i
Hash Table

HashTable o Use PaiedT)pe d Data ol dg o€ d ftc fuq srfl t qe Collection ,11 Array List o't ars 6) €lo i
i i
w {r$ Item a'l Access oG d ftq Key Use Idq qror -tsi q.{l Items qil co Key rlfit
Value Alray il Store
r)i qdl i
Value A +fi d{d s{{n {r,il Value A qF{ w Key fi dfi t
Stack :

Stack Tfi Vb.Net Collectlons oI qsc i sl fu data Struchue A Stack dt 6 fi ord o{dr i q6
fl last in fust out A
sEr]R orq o{f,r t g.si srzr urput d lic Push 3ik Out d fuv Pop operation or Use fuqr qrnr t r

Syrtax dim <Stack name >As New Stack

Oueue :-

q6 ql Tfi sflr fl s1ar Structure i s) 1a Queue dl (i6 Work o.{or i r tsi First rnF st out(FIFO) A 3r{flr olq rtr{dr
i r-iri sq$ qci usert lqq {qI item trq$ q{i !ro-{ qrsrr 3iti llqt last i i
input fucr .RI tem last qns qrqql
S),nta{ Dim <Queue Name> As New Queue Ex-Drm q as queue Enqueue

QlG YB.Nett Subroutines al sfl qFd €€r{i I

Ans-c{ suhoutine, .i]:zi..c{] ar cfi Block i d qri,nBd fu{ {c {S.c{r o} qtcii{ rtr{(I i &.-{ ri
Block,Sub End sub d qo ne n e.rlio fuv qd i

Ex- Open Visual Studio and Select New Project as Window Application and and Drag and Drop conhol into form
Show in Fig and write the code into button click and see the result

Pubfic Cfass Form6

sub Cfeardata o
TextBoxl . Cfear
TextBo><2 . Cfear
TextBox3 . Cfear
End sub
Private Sub Buttonl Cfick(Byvaf sender As
Systen.Objecl, ByVal e As System. EventArgs )
Handfes Buttonl . Cfick
Cfeardata o
End Sub
End Cfas s

Qll-VB.Netq Function oi sa. cG-d swrii I

Ans-q{ qR1q \'o Subroubae qr rt$qq d ore fi dor i r+d A< n 1v er<q qr dtcr B 1} ,r(Iq iq of M os soar
i t e<fu Subroutine toq ol M qS og soo t qo qet.r d ErI Callmg prograrn ol qqs tm .t{ i"q ol M iq.
ori i cp.n iq 6t s-r erJq ,n€c d slcr zdq t wrq Match o($ qltt ,rtreIq Sutroutine 6l ({6 A fln-.c{] al
Accept ori ir fuc {tzn--s @l ffif, o{fl B, st Frurction. . . .end Furrctlon A w ird i {".'rftd o{d it Frurction aJ
'R r{. , rr. -,o rul ol i --r i
Function Function Name As DataType

Statements

Prepared By-Nltendra Tornar Page No-17


Return Varname

Endf,'unction

r€rn fu< qr{t-s-5

Gtl E Eq !Hq{ i 3n-ti"qs d pass tnrd t, 16 oqr fl qqrt.r t,1t 3n*"q{J Pass o{ sf,i i er{i"qr le Mrer
nqq6ifitsl ManBlockt .rqr1q t Prass dqrfiB lsas6d.rRFr ol ,rel.l Ii< o.r-$-.en o6i t ls+r qs.r
Frqlifuo r"c it 6tfl i eflar l?Ffalisa $c i Etar t

Function Function name (Paramenter List) As Data Type

Statements

End Function

F{rn n nRqfd Pass oFlr-


dw 1b aa eo gd t fu qR1.l i Arg:ulemts aJ Passorsodt rn.q-{n"qs nriqqd d $q il Pass lirt ',lri i 'dc 6q
trRrr n ftffi nRqqd or +.nS-e d rv i Pass qrd t, rit FlFftito <t ]dq;rs t o{ {rf,i i
1 Byval

2-ByRef

Byvalr'Byval'?1 tF-< s. t ssor qpf i fu iRTqd a't o"ffi qRrr qr Suhoture i Pass orq t 6q Copy a't rd
w
tq i Change or lroi t, oq w Change , Original Value t !"rffi Tfi dr,n ByRel "By Reference" or nBw t i
c6 Byval i
Alte ntive t ssor s,"l t 1i, 6q Ongrnal Valable d siff ot i"sd +fi oq € i <fu original
Vadable ol Poit s{ {i t I

Number of Arguments
qFrqarTfi!ffirq{crqqrtw$"qs,t'rrtu*wq€qa'tcR,,rr1riliszd$-rierdBrd,tJrqritfiq{qqRrrEr
Call tnEor B, sS s'lr o.n$"qs A ft{ iqq d Speci!, or< qlB{ r Erdrft ofi aqt .}.rc q6 {S qq qi i tu 1ir(i
en.{i-qr lHrsi il Pass lt{ qq,) ,t$q{t u) Averages rffiwr, Multiple Values o) s.r{i!qs sq i Accept or soi
i,fti{dt fir{dl l#r erfq w {S er+ qfi t vb.net 2008 Param A[ay dH ot wH oro i d qo itqtrqq t qo
diqro ol +.n$-es o't rrqr d $q t passori d+5rfi ior B q.D s<rE!"r d q:aq il Eq r-c Topic o't rqe t. t sqsd
i
Returning Values from Function

Fmction ffFfl a'Ifl€ A ord tnror i r rir€tqs opr qR1.l d qq 5q 31 q6 Etfl i ]a rH)et Main Block v Calling
Prograrn t iq ol ]U +.jt oro i, qEfu qRrq ncl al M oq so,ar t qc trRrr iqal Callilg Program rr Main
Block ol M orm t nq rE Fnnctron Wrth Return Value q Retu rg Value Flmctron d 4q ir qEr qrcr t t

dqrrd qr{f-,s
w t'Idtq{ q qen t
s.rqn-c{] al 3iiE1{d ,Jl qcrqr qr sr.r t EnlEr F rstNE
er{iXe ol eiiqrcd .nri ti lirc Optiorml aH or rdr,r fuq slnl
i qc 6q s.r{i"qs al ffi s{d i, 'r< rS optronal fu d rm
s.i eiiqrqe ccr rffit t via w +.n{i"e ol 3nRrqd {rrd i nl ir.T
s'lr er{i"er ol ,it siqrr .r.llfl qrLq{ oen r.ifi en'Nr+a +r*-e ti
liry qo default value Specifu orfi aftv

Function
Function Addtion (Byvaf a As Integer,
Byvaf b As Integer) As Integer
Dim c As Integer
Prepared By-Nltendra Tornar Page No-18
c:a+b
Return c

End Function

Private sub Buttonl Cfick(Byvaf sender As systen.object, Byvaf e As


System. EventArgs ) Handfes Buttonl.Cfick
Din x, y, z As Integer
x : TextBoxl. Text
y : TextBox2. Text
z : Addtion (><, y)
TextBox3 . Text : z
Fn.i srrh

Q12- VB.Nett Conhol structure 6J {qsr$t I

Ans-c'S{r+d €"l'd-€ qr qd d.d,s


qd o-ira rtzi.sq q a-Ctr+d .dzi-cq, w .ttzi-.e-g di t ql w a .t{ o-elFr A oux w rtzi-.eo u vwr.+s ol
qiqlf d{i i g+ Decision Statements fl s6i i VB.Net i fi A .rJ a-gy[r A erux w r$.er o) ffiq( fu qr ql(I
VB Net t 5q sq t F]qfufoa Decision and Conditional ie-t-cq sI wl.r fuq srfl B

(a) rf .Then d-e (b) if.... Then.....else riai-e


(b) rf .Else ifladder ,ttei-e (O Select Case {tzi-d
(a) if.....Then #.e-if Then ]7,€{ {]rq.r{q o-aa ql qo 1ift4f, q€q o} rir.if oG d ftl po t
sqt B
ffi VB.Net qNiTr d Fl(I SpecrS/ fuq wo B w ra-.qt d+o True o-elr;l d ftr fuvt6 361 g =o-
qFrr{ qTsrl FlqfuRq( Fc i ddr t

Syntax

If Condition then
Statement IhEck

End IF

Example

Dim Marks As Integer


Marks : InputBox("Enter Your Marks")
If Marks > 32 Then
MessageBox.show("You Are Quafify Exam", "E:<am ResuLr,",
MessageBoxButtons. OKCancef , MessageBoxlcon. Inf ormation)
End If
(b) if ....Then....else d-e if #e d{d True o-€lqr d 3 qR w {tzi-c al ffiqf, oqar t 3rd qd
.{qEfi sqiFn {S t qq aq sl6i t ft True nln Fahe et+ o-e{I.l d olerx w dr-e ffiqd d il Esd rn(
If ... Then.... Else rtzi-e or rq).T o{i i gsr rlzi-e oI qrqq yrsc FrEFdfuo $c i dff,r t
If Condition then
Statement

Else
Statement

Prepared By-Nltendra Tornar Page No-19


f,nd IF

Dim Marks As Integer


Marks : InputBox("Enter Your Marks")
If Marks > 32 Then
MessageBox. show ("You Are Quafify Exan")
Efse
MessageBox.show("You Are Not Quafify Exan")
End If

(c) if,,,,Elseif Ladder eeh-d- if ....elseif .llzi-d d qqq t ftffi o-Siir d Tme and False rli [i EsS s@(
{tui--fl ffio Eli Br qs qdlqd 1itod t t liffi w ftf,q t r@( o-${q d r.q ai w rizt-e o)
foqfi-d o.{ qrEd troq if....elseii....ladder€ei-e or rfq ori t ssol ElqFq $$. FIqfufufl r.t dcr B

If Condition then
Statement

f,lseif Condition
Statement
eDf l

f,lseif Condition ,",f l


Statement
turf l
f,lseif Condition Pe'f l
Statement D"*,f l

ai.fttl
f,nd IF

(Oselect case dEe select ....Case {tet-e aI r+.r Multiple Choices i t Iiffi qo Choice d +ntrrt w ttel"z o)
ffiqd oG A fa{ ftqr qror B gsor qFrrq yTFc Ftqtutuo sc { *dr tr
Select Case
Select Case <text E{rression>
Case e{rression List 1

Statement
Case e{rression List 2
Statement
Case e&{gssion List 3
Statement
Case Else

Statement
sub Maino
'focaf variabfe de finition
Dim grade As Char
Cons ofe. Write],ine ("Enter Your Grade")
grade : Consofe. Read],ine o
'grade : "B"
Sefect Case grade
Case "A"
Consof e.WriteLine ( "Excef f ent I " )

Prepared By-Nitendra Tomar Page No-20


Cons ofe. Writeline ('rweLL done")
Cons ofe. Writeline ("You passedr')
oIe. Write],ine (r'Betler try again")
Cons
Case Xlse
Consofe. wrileLine (rrInvalid qrade'r )
End s eLect
Consofe. wrile],ine (r'Your giade is {0}", gradei
Consofe. Readline ( )
End sub

QllVB.Nett Loopingel err6i t

v'qtd c.if #"qs q @.r


qm qr t qEfi .dzl-qs d w fiR{( €qr q d( d.qqra w fsqrfu{ o{i d faq
q{ qror t r

VB.NET i Eq sq t Fqtutuo nox d e$'q d-.es or rqlq lbqr omr t t

l.For. . ..Next qr
2 While. .. .Endwhile Loop

3-Do x,hile Loop

4-For Each Loop

l-For......Ne* Loop- For ....Next Loop s,@{ sI t 3rEo-d-cq ol q6 litrqd crd d qrqx [r
ffiqd 6{i d faq ftFcr qror $ For ....Next i frfl i {6]" T! Counler, variable or {q
S rFor....Nef Loop o) we w t sqsi d fis qq t-
w<rtwr qo lorm ol fuqe ori i gs Form qr qo cec ol add 6ri SI {er w Double 1tr6 ryi d l

vHn ots N
t Fr.qftituf, ots d lirsi

For Loop

For i: I To l0
ListBoxl . Items. Add(i)

2.while.....Endwhilc Loop While ....Endwhile Loopw #e qr ffi.es d qo do ol speci& d r{ o-Sn d


sq ui ro ffiqo qiror t White Loopgw rr tTqR{Rttr+,rfuqr qror trqd wriqriS q6 Tfl {S *f,r t
fu(cdffiaRfitqrtudotidsrrotr While ....endwhile Loop or yrr. mfuf, sc i *dr t

Whib Loop

Prepared By-Nitendra Tomar Page No-21


Dim I As Integer : 0 'lrrtialization
While r <: l0 Colrditiolr
ListBoxl.ltems.Add(i)
i:i+ 1 'Tnclerrent
End Whrle

3.Do {,hile Loop Do While Loop d orr fi rtcr t dfuc rE While went Loop t ss s. i crsq ao t fu ssi
Specii/ a't rtd s-Cltl rdo rteration d qt< t rtzi-e d endi l?oo Chack rlfi t qqFo while ........went Loop i
Specii/ a't .tJ o-gF1;] qfi srs,q €ifi i, (q qt €-i.e itrq iI itrq w ER 1ffi4 rlo t w qr or vrt- F|Fftfud $-il
dar i

Do While Loop
Sub MarnQ
' local variable defuutiot
Drm a As Integer 10 :
'do loop executron
Do
Console Writelire("value of a {0)", a)
a:a+ 1

Loop While (a < 20)


Console ReadlineQ
End Sub

4.For f,ach Loop- FoI Each Loopw lilw it q..t Items A qreqq t iterate €lor qr liqz yo N q eiid{s<r or
ir
ddcyn El sfifi i
Fol each Loop Fol Loop ora fi or{ oro d t For each Loop ol trsc Frqnfuo oc 6rfl t t
Sub Main o
Din anArrayO As Integer : {1, 3, a,'1 , 9}
Dim arrayltem As Integer
'o p -- 9
For Each arrayltem In anArray
Cons ofe. WriteLine (arrayltem)
Next
Consofe. Read],ine ()

Q14 VB.Net t Message Box Gfl Input Box 6J €qfri:A I

Ans-Wl@-VB.Net t 5rge .frim or cq].r Form ii {r


d Jc w tai iJ Ten oi trge s{i d f"{ fuq qm i Form
w Inqlqf, Tert Boxd qeqq t {q{ t sld1 Fqe d r"c t f EK_l
ql< fuqr qm i r+re dtm aw t Form d rc. s i srcr aJ
s,rgz o<ri o q{ru liow i Terl box it 1ixll ff edc or rdI
sra {lge oql rroi i, qqfu 5,rge qiw t Characters and
Stu)g at a{ge arro{ Texe boxt rz'rs os {roi t tige
d'wr or trl$. Fr]-filfuf, $c i itdr i I

Dim a As Integer
a : InputBox ("Enter l.trumber" )

ttq t t$s qiw or rq).l lixlt itro cr iRTqd o't Aq q 1i^t Rd.e al nSq A
dtm VB.Net q1?r rs1if. o{i ri fti tuqI
, , ( rEiISa o! . .rd t
" " ^
Msgbox("Message')

M "Messase" & var name

ssr.-wr {o Formw oqrw qac aJ Bqdq o{i t, gsr oql.e qec d ots fu t <T tqrci d Sum ol Msgboxd av
r<Rt( o{i A ftr o:ls ot ftrsi B r

Prepared By-Nltendra Tomar Page No-22


Mes s ageBox..show { "Thj-E is
Message Boxr', "Mes saqe
Captipn Here",

MessageBoxButtons.YesNocancef , MessageBoxfcon-Information)

Prepared By-Niterdra Tonw Page No-23


IInit-3

Ql- Window Form flI t ? gtr$ Loading, Showing nin Hiding6) Tqgr{i I

Ans- Mndows Form fusfq q.il .dz \ffinc d fui ro u6oa qw i s) CLR (Connnon Language Rmtrme)
or qqJ.r oEor i ftsdo rdtdtr.rs ol Fomw Conhols @l Add o{d'-iiTri{dc l}q qo ir cpr Mouse Clicks, Button
Clicks scql? d r"c t Events aJ i"sd fuqr qror t VB.net i Folm fl rqlq ord 6q 1iftq oir A qdAir.flr fu\'e o{
qoi t lffir1{s ol s.qE{ qRI.l nln User Friendly qcd d ftn ag ni6 d Contols @) From w Add fuq q soor i
Forrn al Load, Show Gfi Hide 6{nI

VB NET i
qc Eq ftsslq l€Idl1.r i Form al ffic ryi d grqd {r o*i i, oq qs Form Memory i .its ddr B, (9.,r
6!lt qlqi {dlq w rERfo fl B qo c+dr1.] i w t qfrfi Form al }t fuqe os rroi Brcp"r si e{cq i 1i{.il o{
{roi t qd cdd{q iqd i qE{ Fonlls d fu\,e osd Bqlfr o{ {Jod t alar qfi {rqq i w fi Form d}c +dr i n!{
qfi Form Memory t drs +dr B
qq 6q cfi \€BiI.] i rfi t qEo Form al ra'e o{d ffiq d{i i cl g-+i r} fuq Form o't sc q-Jc w dtr w tr<fif(
osqr q6i i irfl Form ti ftq ShowQ !sr-s fl rfq osi i (q,l fus Formd rdr< n E-ql;lr sr6i t ss Formd lig
HideQ !sr-s or rdq oii i
d{]r qR Forml and Fonn2 d Form q.D A ,]fr[r i i qli eq Fom2 o] rc ergq w r<Rfu ol.]1 qrri B cl Forml d
eec al fufi
i
Event FlEfatuf, ols or li|gi B

Fomr. Showo
Forml Hi

3rq{;lzdqwqq6qFomla{eiwftdooGinrFomur<Rfodrflinlreqlffir1qolso<rdtdBydefault
First Form rsPlo +dr i g€t ors Form 2 d cec a) Click everf w FrFFdfu( ds ft|gd i

Foml Showo
.

Form2.HideQ

qs Fom2 d {ei w fu{ o*i i cl Form 1 r<Rfo rlo t oen Fonr, hide rt qo t

Q2- 96 Form 6l qHt Form tfit Controlfoq qror tt s<r. €Fd€qrfr{d I

Ans- Pubfic Cfass Forml


Private Sub Buttonl Cfick(Byvaf sender As
Systen.Object, Byvaf e As System. EventArgs )
Handfes Buttonl . Cfick
Dim obj As Ner^/ EnquiryDetaifs
obj . shor./ o
Me. Hide o
End sub
Private Sub Button2 Cfick(Byvaf sender As
systen.object, ByVal e Es system. EventArgs )
Handfes Button2 . Cfick
D oo_ ^ \6.. ^o^ o
obj . sho!./ o
Me. Hide o
End Sub
Private Sub Button3 Cfick(Byvaf sender As systen.object, Byvaf e As
System. EventArgs ) Handfes Button3.Cfick
Prepared By-Nltendra Tomar Page No-24
Din obj As New BookDetaifs
obj . show o
Me. Hide o
End Sub
End Cfas s

QlF.fr. Contmls o\ vr$ Methodq Properties GII Eyent sfud Er{gd I

(l)Te* Box Conlrcl

Tei Box control go Windows Foms Control B, d ri


rc eEq w w Window qq Tei o) Enter o{i o1 icr ir
Bydearft, vo Text Box Control dqd w dl{r d Tet' aJ Accept o{dr ir 6q Ten Conhol Ten i
Control i t
Sqoll Bars ol Add and Control Te>d d Editing o) Disable ot sod i I gsd fuq Eq Te_x d
rroq srd.r ffiq d ffiq
ftsd n te o€ i r Window Fonns Te>d Boxes User Eqgc di nln t ?*
ftc yqtq tuc qrt t r

Exercise
Buttonclick

Dim a, b, c As
Integer
a : TextBoxl - Text
b : TextRox2 - Text
c:a+b
TextRox3 - Text : c

li

Property De$iiD]tiflr
Multiline co Q creo Line q ren 6r ffi a
'nH Hg 're
ScrollBars,.:1 ,. ot vd.r Vertical ard Horizontal ScrollBars oJ
oli d fal fgq qror B r

Maxlenqth aI vd{ w Text Box Control d qnr Characters


,.1 .l\ d qBoaq {qI d Accept ori d ffiq f$qr qrfl i r

qft gs fuf o) True ie o€ B, d Control d rdq or


B-ea-doffy soi i cpr qR eq ful ol False ie ori * d Control
or rqlq +S o< sot t r

-.:',:
Event Description
Autosize Changed qq Autosize Propertyd Change
flq qror B, (q q6 Event Trigger
Readonly Changed dflB
o< ReadOnly Properties Value o)
Click Change fuqI wct B, (q ..E Event
Trigger dct i
qq {s Conhol oJ fuo fuq qn1
toq qs Event Trieser +fl B t

Prepared By-Nitendra Tomar Page No-25


Method DescriDtion
srrar gqdq Te>.1 box oJ Clear
Clear ori d 1ic tuq srfl t

(2)Label Control

Label Control, Window Form w rqlq fuqt qli qror erqBo Connnon Control t w Cortrol ol rql.r {Jrq1qd Te)'1 @]
r<Rt( fli A ftv tuq qar Br N qw d rm ceoi dt !fr< {S a'l srfi i r

ProDerty DescriDtion
qs fff or rq).l Contol d fi{ BorderStyle ol *e o{i
BorderStyle d Iic tuq qrfl ir
Flat Style qs fff ot qq).r Label Contrcl d Flat Style Appeamnce
d ie o€ d fa.< tuq qar tI
Tet g{ fff fl qq).r Label Contrcl w Text Contol oJ fre
ori d lic tuq srcr t r

TetAlign g< fff or nq),T Contol i Ten d Align of ie ori d


fi.r fuqr qldr t

Method Description
To String 116 iqS -o string ol *e arot tS Control s) nrq ol
Tqar t I

Event Description
Autosize Changed qq Autosize Propefy d Change
fuql nrrd B nq c6 Event Trigger
€tar B
Tabstop Charyed qd Event (q Tngger Eldr t qq
Tabstop ffi
Change tlfi t

(3)Button

Botton Conhol ,Windows Foms Contols oT w qgq Contlol t r q6 Contrcl Click Event d qc€ o{i d Sfu @)
scder offir Botton Conhol d Click Event d em r< zr$r w qw E6 cqirc al qwd o{f,r tr Botton Contol dl
tr
rge Properties ol trIi i
Table rEPr( fuq wr i

Prepared By-Nltendra Tomar Page No-26


Proprety DescriDtion
Visible et] frqdl or tr{itrr Control tl Visible qt Invisible @{i d 1}r fuq qar Br

Enabled et] frqdl oI rql.r Controlil Enabled ori d 1ic fuq qrfl t
Backcolor e,s frqdl sI [drrr Control d Background Color oJ ire o{i A fti{ 1}!l
qoB
Image
e-sfrqdl or rjrrr Control d Background Picture dr ie o{i A ft{ full
srcr i

Event DescriDtion
Enter q6 Event nq qr€ 6if,r t qq o!l-s qe,l Control Focus qit
qrw srfl i
Click q6 Event nq qr€ 6if,r t qq Control a) 1?f,o fuql slfl
B
Leave q6 Event nq qr€ 6if,r t qq Control Focus oJ sJ ifl t
Method DescriDtion
Perform click g1] iq-s or trdrT Radio Button d Iiv Click Event ol qc€
o{idftttuqqoi
(4)Listboxft-E Ciffi oE{d
IiE d'wr oq[d or wl.r Itemsd 1]{= o} r<Rtf, 6ii A ft{ fuql srcr Bt ffi iJ {w w qr w t qf}o 3r .rc.ir dr
qiqe os soo t qfi ]a{z .f{] n 3nrs?.ii a't tqr vo I-traf, frqr it qrq dt qd i d Tfi Sqollbar Ha 6 fuse .frrffi t
roe r) qm B u) 5ui d furz d qEqq iI Scroll o€ a't.Eqid idr i gfi Scroll Bar
Exercise
btrMoveRight ClickListBoxRight. Itens . Add (ListBox],e ft. S efectedlten)
ListBox],e ft . Items . Remove (ListBo:<Le ft . S efectedltem)
btnMoveleft Click
,I
ListBo><Le ft . Itens Add (ListBoxRight . s efectedlten)
.
.l
ListBoxRight. Items. Remove ( ListBoxRight. sef ectedlten)
btnMoveRightAll Click
"l
-l
ListBoxRight . Itens . AddRange (ListBoxLe ft . Items )
ListBox],eft. Itens . Cfear ( )
btnMoveleftAll Click
ListBoxLe ft . Itens . AddRange (ListBoxRight . Itens )
ListBoxRight. Items . Cfear ()

siin c{ ft{e d'Nr i [oe dor t r q.r Scroll Always Visible Properties True te rlff i fut= .iiw oq[d a't lIg
fr'qdlq al Frqtutuf, Table t r<Rio tuq rur i

Prepared By-Nltendra Tornar Page No-27


ProDerties Description
Column Width gtr fff or rqlq Colurm ol Width d nc oG d fac
ftqr qldr B
qR ffl Items d w oAqfii o) M oro t
Items rR Multiple colurns d sqH foq qo i, qE {s frqd o1
ie loq qar t
gtr fff or rqtq sde fac .rc arl{dq d yrK o{i d fis
Multicolumn ftqr qldr B
gs fff or rd.r $i€ f6c .rc a6cd ol ll.< oG d fac
igqr qldr t
Selectedltem

Selectedltenrs

Method Description
Clearseleted 5n qelg ol cqrq olqld 6 LIg qiit{ ol qd ot;l d IcIq
FindShllrg flq qror B
GetitemHeight E{ iprs or r+,1 First Item d @ d fav f6qr srar i d
SetSelected Indicate .r{ String d tw gt, stot tt
d
E{ ie-s oI q+r rro ql{eq d He4thd M ori d fuv
flq qror -B
w nl{g 'i,1 tr+,1 Indicate fuq rri ql{cq oJ Select qr
Deselect aEi:d fls f$-qr qrfl B r

fvents D.se.riDlion
Selected Indexchanged q Selecteiffndox ff ol Change foo vror t a< aa
Click Event qclz ddr t
qq f e dw d siqe faq qror t, qq ir6 Everf qrte
dfl *
(Ocombobox !rf'q] iffi E-{td
ComboBox Conhol fuE dtr o'drd dl o{6 8 *fl t d Multiple items d refl i, ffit{nsftffi so o) si€ or
trf,dr tr 6q o6 sri B fu ComboBarx{fi Expandable Listbox Contol t, d (E lir<rR( ddr B, qq {w fiffi Item ol
sie oscr ql{fl t cqr si€ o{i d caflfl riAK r} qror Br srqrqa ComboBox Contol {i€ fird.ri Item d sr:r qo
e6< o) rcRfu oror S r CopboBox Conhol a'l frqd ol Flqf fu( Table i r<Rfu fuq .rq t

Exercise
Buttonl Click
Din vaf ,\E string
var -: ComboBoxl. Text
MsgB ox ( vil.r )

Eorm2 load

ComboBoxl. Itens.Add("Sunday")
ComboBoxl. Itens . Add ( "Monday" )
ComboBoxl. Itens.Add("Tuesday")
ComboBoxl. Itens . Add ( "wednesday" )
ComboBoxl. Items. Add ( "Thursday" )
ComboBoxl. Itens.Add("Friday")
ComboBoxl. Items. Add ( "Saturday" )
ComboBoxl. Sefectedltem : ConboBoxl - Itens (3)
Prepared By-Nitendra Tolrar Page No-28
Exercise
EorD3 Load
ComboBoxl . Items . Add ( "i{e e,..iays " )
ComboBo:.1 - Items. Add ( "y ea. " ) t6---------l I-----------l
ComboBoxl selec tedlndexchanged

ComboBox2 . I tems. Clear ()

If ComboBoxl - Selectedltem =
"l"leei.dal,s " Then
ComboBo:<2 . Items. Add ( "suirdal," )
ComboBox2 . Items. Add ( "Mo1day" )
ComboBox2 . ILems. Add ( " Tr res iay " )
ElseIf ComboBoxl . Selected Item : "vear" Then
ComboBox2 . ILems. Add ( "2 012 "
ComboBox2. ILems. Add ( "20i3 "
ComboBox2 . ILems. Add ( "2 014 "
End Tf

Properties Description
DataSource t<l fff ComboBox d lid Data Soruce oJ rle ori d
ft{ fuqr qldr i
5n fr€l fl qqlq CornboBox i Item d oi€.r al
Items Rehieve o{i d ]iry fuq qo t r

flr fff al cqtq CornboBox i Cunent Item a) {ra€


oG d 1 fuq qror ir
Selectedltem e(] fff i cqtq CornboBox d TexlBox Parl i Selected
Terl ol ile tnri d Ii{ fuql qrfl B
9n ,i€f fl qqlq CornboBox i Itetx o) sort r,,c i c<lifu
o€ d 1ic tuq erfl t
SelectedText

Solted

Methods Descrition
Find St ry qr iars ComboBox i Fist Item oJ {oo t d Specifu o't
Select A11 lff sh]lg d I]Iv r1r rtor tr
qt tpris Combobox d Editeable alea i q',1t text al tr+{c
o.ror i r

Event DescriDtion
Selectedlndex Changed q6 Selected hrdox Properlies o) Change fuq qn t, oq
Click qe eie q{{z +fl t
t
qc ComboBox oJ sde fuq qror (q qd gic sr€ +ar
B

Prepared By-Nltendra Tomar Page No-29


(QCheckboxio df* or4ia

io qiRr a€td Box Shaped Control d sc t ffi€ fuql qfl t d qrt ol w siiq.l qil Clear q Select ogi d ful
l? eBq !-Tfl i io dw o"qlo True qr False ib Fe t tq d 6ox oro t qo Check Box ol s+qe o{i d fu 6n
e{Jwfufi oiq €to i ap.r Clear o€ d fu tfiws.r fuo o(+ srm t qs Eq cfi Check BoxoJ Select ori t d
c6 True Value oJ Hold oro i nefl q.r Check .fi.E d Clear ori i r qq FaLe id a'l Hold oror i
Exercise
Private sub CheckBo:<1 Checkedchanged (Byvaf sender As systen.object, Byvaf e
As system. EventArgs ) Handles CheckBoxl. Checkedchanged,
CheckBox2. CheckedChanged, CheckBo:<3. CheckedChanged,
CheckBox4 . CheckedChanged

Dim num1, num2, resuft As Integer


numl : TextBoxl. Text
nrrm2 : TexlBox2 - Text rnr", r"rro liii- sub !=l5
Mu s=100
r.r.s..*ar" F- D I is=4
If CheckBoxl . Checked Then
resuft : numl + num2
TextBox4.Text : "Sum is:" &
resuft & vbNer.i],ine
EncL It
F MutpEBrm 17 a;;;;
If CheckBox2. Checked Then

resuft: numl num2

TextBox4 .Text &: "Sub is:" &


resuft & vbNer,'/Line
EncL It
If CheckBox3 . Checked Then
resuft : numl + num2
TextBox4 . Text &: "Muf is:" & result & vbNehTTine
EncL It
If CheckBo><4 . Checked Then
resuft : numl / num2
TextBo><4 . Text &: "Iriv is:" & resuft
Fnd T t

ProDerties DescriDtion
Appearance i
ss frcdf qqlq qo Check Box d Appearance o) ire
ori d fu fuqr qror ir
ql? CheckBox, Checked State ii
cl Value ol rle osi d
Checked ftd ss frqdl or rdrq fuq srfl t
eH fff i cqlq Tlnee State Check Box d rle ol te
CheckState ori d fu ir
fuqr qror
5q frqdl i rfq Check Box d Flat Style ol rle oG d
tui foq qar t
FlatStyle 5q frqfi i rdrq Check Box d Check States ol Specifu
ori d liri fuq qror i r

TlueeState

Prepared By-Nltendra Tomar Page No-30


Event DescriDtion
Appearance Changed qq Appearance li'qeJ q<dfi B, a< rt Event,Trigger t)cr
t
Checked Changed qq Checked Properhes ceodt t, oq c6 Event Trigger 61fl
t
CheckState Changed qq Checkstate frqdf {sdfi i, o< rt Event,Trigger dtot
t

(7) Picturebox ft-ffi itffi 6'{td


fi@{ qiRJ o"qld or wlq q.D Bltnmp IooqJPEG,CIF q qflfi Enq qr.s? zdcl t qfiRr ql v<]if( o{i ri ftd t}q qcr
i ftqs niw i eiq a't E+q mqe-t al 1td o{d ft.Ilr .it w rtq ot r<Rio os soi t liqi niw o-.dtd d rqo niqdlq
Fqtufco &d n r<ftto a't 1lg t

PictureBox Load
PictureBoxl - Image = Image-FromFile("E: VB
WindornsAppfica]'ion2 Wa]'er
Demo windo\^rsApplicatioD2'
1i1ies.1pg")
PicLureBo:{1. sizeMode
PictureBoxsizeMode. Stretchlmage

ProDerties DescriDtion
BackColor g{] ffl indrq o.dre d lid Back Gromd Color oJ r)e
ori d fu
fuqr qror Br
Size Mode ss iiqdl or lqtq A rid Size Option ol 1td o{i d ftt
fuql nrrcl i
Font s{r frqdt i sitr o.nd d ftrl Font Style iz o€ d ftri
fuq qror i
Image 9n fff or rfq Label Location and Resource file il
Loadd.r9l e,iq d Specifuo€ d ftd tuq qn t r

Visible *r frqJl tn cfq o.aro ol Visible ori d ftd 1iq qror


i
WaitOnLand s,{r riqdl i rqtl {€t Eiq A .is 6ri (o o€ ti
tui lbq qo i '.corg

Events DescriDtion
Resize qq Pictue box o) Resize fuql sIfl i c.r saEvent
Tngger €tor i
Si-reModeChanged qq Pictue Box oI size Mode q<cot i. n.I q6 Event
Tnseer 61fl B

Methods DescriDtion
Load i
s6 iqs Picture Box Conhol s,iq al q<Rfo oro t
qg i:rs Aswcluonous Imase Load aJ Cancel orot i
Prepared By-Nltendra Tomar Page No-31
Cancel As),ne s6 iars Image a) Asyncluonously cils oror i
Load As

(8)Radio Botton tES rec 6'Etd


tM eec @-e[d o't i }t qm rrm i ts o.+d r yql.r 3frRn d qo te i r} qo ciixrc o{i d fu
ricF {eq ti l]Iq
laqr sm t tld lzAs qFrqf, vos6ds.r iordo€t ssor s.p.l i tu qs ,fi ttujt .rr+s d eql t t qn tl-ql
.rec al rrA€ oG t d ry A (sf fRd qr+s rqo6l Deselect d qri t gcf qait ieq or sod i f{ tM qz.1=s
Siryle Select choice ti ftt rdrq ft,i qi i tMt qec o-da oI Form qq Add o{i d ftd qefw t il qlss d ErI
tfu ceq oq[d o] sie o€ t er sd Drag ord Forrn w sfu( &rr w Drop o€ t
Radio Button d rJe oJ Checked fff ti elq1 +ld o{i i sl Radro Buttol o-i]o d riid 1i"-i n trEff( dfi d
Exercise

Private Sub
rbtnAddtion Checkedchanged (Byvaf s ender
r"- r r" Ijj- As System.Object, Byval e As
+" r--r r" li- System.EventArgs) Handfes
rbtnAddtion - CheckedChanged,
rbtnsubtration. CheckedChanged,
rbtnMu1Liplication - CheckedChanged
l; addlion a SubrrBlon
Dim num1, num2, resuft As Integer
numl : TextBoxl. Te:<t
num2 : TextBo:<2. Text

If rblnAddtion. Checked Ther,


resuft : numl + num2
Te:<tBox3 . Text : resuft
Efse I f rbtnsubtration.Checked Then
resuft : numl num2
TextBo><3 . Text resuft
resrr I t : nrrml
Te:<tBo:<3. Text : resuft
EncL It
End sub

ProDerties DescriDtion
Te)'1 sq ,icdf fl Tf.r s"qld w text Center Ahgn ol rcRfo
Size ori d liri fuq qror i r

Checked fl
5{r riicdf rqiq o"St r o't Widtb Size d Specifu o{i d
FlatStyle tui foq qar t
Image q6 riqe-f <I1ffi t tu tBqr eec al Check tuq rur i
InmgeLise 5s frcdf fl rfq lt}jt c-r d Flat Style ol ile oii A ftd
fuq i
qror
i
ss frcdf qqtq lki .rac q{ s+q r<]ifu o{i d lAt fucr
srort
i
ss frcdf qqr o"qlo w Images o) r)e o{i d fun fuqI
sror i t

Method DescriDtion
PerformClick 5{ iqs ar rf,l lB.i c-r d 1ai Click Event d qcle
ori d 1 fuqr qror ir

Prepared By-Nltendra Tomar Page No-32


E!1rets DescriDtion
CheckedChanged q o-zla o) Check w Change fuqr qo t, qq qs i+e
qqie dor i r

v< oQa d Appearanc e Properties Change tlfi i, e<


Appearanc eChanged q6 qrtd ddr t

(9) Panel t+a oa4la

Panel Conhol oI r+.r (st Contrcls d


croup a sc t trsRtd o{i d fui fuq -lqr } Sror nf.r wn-co To Form o)
lillq Resions i fqITGf, oG A ftd fuq qror Br N qrcr q{ Menu il d Panels t ffi qo Panel it {si A ftrn
Drinks q;) sde oG a'I 3,Eqf di tr ow q{rt Panel i Juice d Tlpes d trie dii d .i3qid ad it r-fl Conhol t
Contrlos d Groupiry ffii ersr w Controls d ire d i"sa o!;fl 3ns1q {rr ifi tl Panel

Properties Description
AutosizeMode at mrfi o-.eta d Automatic size 6 Behavior or 1iq1'q"t
q{fiit
vo frrd Speciff orfi t 1b Panel Control 3rqff Visible
AutoScroll bormdary 6 q6{ fu..( lixi o-ela ol Scroll oG d ftd
qr< d
Enable o.fi B q q& orfi tr
q6 mqJI oqd d Border Stle o ftrtwr {{fi tt
BorderSMy

Method DescriDtion
ToStdry !6 iars Panel control d fui w String Repersentatron o)
fuei oror i r

Table: Method ofPanel Control

Panel Conhol d 1id Iid vri oar rye Event a) FlqfAfuo Table i r<Rro fuq qq B

Event DescriDtion
Autosize Changed q6 Event (q Trigger Elo B, o< Auto size Propefties {(A
qrfi tt

Prepared By-Nltendra Tomar Page No-33


Exercise

Private sub RadioBu1'1'onl Checkedchanged


-. Bo. -.
:lefected is :" &F.adioBu1'1'onl. Te><1'
End suk)

Private Sub RadioBu1'r,on2 Checkedchanged


il
!lefected is :" & F.adi oBur,1' on2 . Tex1'
End sub

l,hP hh.dE!Hd3 PF 3d rBr Private sub RadioBulton3 Checkedchanged


se-,.,, ! Bf
l,he tud@ HaE
sefected is :" &RadioBu1'1'on3. Text
Fn.l srb

- Private sub RadioButlon6 Checkedchanged


TextBox2 . Text : "The Cof.rr IOU Have -qel..teil is:" & Ra.lioBlrtton6-Text
End Sub
Private Sub RadioButton5 CheckedChanged
TextBox2.Text : "The Cofor you Have sefecte.l is & Ra.li oBrr ton5 - Text
Fn.l Sr|)
Private Sub RadioButton4 Checkedchanged
a-ee-- & RadioBu1'1'on4 . Tex1'

(10) Scroll bar

wta m o,Ela
Scroll bal control ve ical and Honzontal Controls aid q) qo scroll Box and Thumb or rdit( o{i t,
t tq H
t
Veftical and Hodzontal sc Sdoll sr {roi iri
Contols,items d q{ ddl ft{z cr 5rqifrl-] d cS qar dqqqir
+Arne o{i A fui qri i
r Scloll bar controls sl erJw HScroll bar and vscroll bar d ftri tli t
Scroll bar Control o't
o o-'- .d
"Ftr
ful '{r i
q<Yr fuq ]T'IT
rrc t
ProDerties DescriDtion
Autosize s6 riiqd-f sr trdlrr Contents A Size d s5r. r+o €t Scroll
bar oi ttr r d tui tuq qror i
5s iicdl i
qilrr Scrollbar o-ito d Back color oJ ile
Backcolor ori d fu
fuq qror tr
5,s ri'qdl i
e.nr o"zld d Fore color dr te o{i d ftd
fuq qror i
Eorecolor 5s frcdf ot qdq Scrollable Range o't Upper lirnit o) ile
ori d fu fuq qror tr
5s frqdl i rdt,t Scrollable Ralge dl Lower limit oJ ile
Maximum ori d fu fuq qror tr
ss] frqJl i qctq Scroll bar dl Cuuent Posrhon d
Conespondng Value ol tre ori d 1 fuq qrot i t

Mirrimum

value

Table:Properties of Scroll bah Control


Prepared By-Nltendra Tornar Page No-34
af Control
Scroll Bar d c{s Eveft aJ Flqlilfuf, Table i q<Ffo fuq qq
tq i
Events DescriDtion
Click q.r Scrollbar corhol w 1?flo dio t re Event,Trigger
stcr t
DoubleClick q.r Scrollbar corhol w double Click tlo t (=q s6 Event
, trigger tlot i t
q.r Scroll Event Ti Eldr t, q.r s6 event Tdgger Elf,r t
Scroll
Table: Eve s of Scr ol1 bar Control
Exercise
Private Sub Form2 Load
Hs croffBar 1 . Minimum : 0
Hs croffBarl . Maximum : 100
Hscrofl Barl. smaffchange : 1
HscroffBarl. Largechange : 10
HscroffBar2.Vafue : 20
End sub
lscrc Poiiri.n:lE Private sub Hscrol fBar2 scroff
e^ Boxl. TexL "S - - : "
e. Newvalue
End sub

Privale sub HscroffBarl s croff


Label1 . Location = Ner,, PoinL (e . Ner,,Value * Me. Size.l,Iidth / 10 0,
Label1. Locat ion. Y)
T,abel'l . Ter.t = rrr.{.ve f,Ll -ie oer { r"
End sub
Private sub VscrollBar1 scroll
Location : New Poinl(Label1.Location.x, e.Ne\.ivalue
Labe11. +
Me. Size. Height / 100)
Label1. Texl = "Move io r,l,- .iesL : "
End sub

(11) Timer ur{{t 6"qtd


i
Vb.net Timer Coftrol, Window Application t t
qre{,f ,lFot Ii}-rfl !E q6 eqrd Periodic Events ol fu\,e o{f,I i
Design time w s6 aqd
ComporEnt tray roz elcr i i
trmer Conhol a't Tgs frqdlq 3rrftfuf, tqd q<l?fu .dt t d
t
ProDerties of Timer Control

DroDerties DescriDtion
Enable qr fff
oq ire o't qtrr t, w< Timer Ruming furft n +f,r
t
Intelval s(] ffl i cqtq Event fl Tirne tre oG d lirl fuqr qror
t
Tag g<l fff i c*q User State d Abitlary Stmg ol trd
ori d fui fuqr qror i r

Methods of Timer Control

Prepared By-Nltendla Tomar Page No-35


Method DescriDtion
Start qd irrs Timer al start o{i d ft{A fuqr qrat t
Stop qe nprs Timer o) stop ori d fuA Fsqr .rl.l ts |
Tostring qs tlrs strins tr) R-i oG d liri tuq qror t r

Event of Timer Contml

z16 event oE qrte ddr B. qE speci& foqf.rqr Time


interval Elapse dct i a:l Timer. Enable
Exercise
Dim blnAlarm As Boolean : Eal
Private sub Buttonl Click
Timerl . Enabled : True
End Sub
Pr.ivate Sub

Labell - Text
If TextBox TextBox2 - Text
Then

.ller{ DateTine (Today. Year.,


Today.Monlh, Today. Day, CInl ( Texl), CInt (TextBox2 - Text) ,
CInt (TextBox3 . Text ) )
If Now > Afar Time And b1
Beep o
End If
End If
End sub

Private S
Buttonl . Checked Then
farm : True

i oButton2 Ch ecked Ch an
RadioButton2 . Checked Then
blnAlarn : Fafse
If

(12) Listview fre qo-qld


fte q oda or rd.r Items o1 fuw oJ ysRf( o{i A ftli fucr qror t dt
Colom d fuw gerfi ra Itermo) go oS
n rsRf( o{fi t. fiS Windows E4lorer Window d Riglrt Pane q r<Rfd tuE *fi tr ft€ {a"qld rgq d fflq
Fqfalqo aco t rsRlo 01 trfr t-

Prepared By-Nitendra Tomar Page No-36


ProDerties DescriDtion
Items in fff fl rfq Items o'l 1ie d fti fuq qar tr
5{ frqdt fl trdq Te),1 Alignment d +c oG d ftd l6q1
Alignment qror t t

5{ frqff fl rqlq Backgrormd color oJ r)e oii d ftd


BackColor fuql qldr B
5{ frqff fl rdq control d fui Font Style ol Specifu
ori d fui fuqr qror B r

Font 5{ frqd fl vdtq Control dl Width d Speci$ e€ d ftd


fuql qldr B

width

Forms and Controls d rnar GIII ffi.r


ProDerties DescriDtion
Backgromdlmage flr frTfi fl trIitq Backgrorurd Image ol r<Rfo oti d ftd
fuql nrrd B
flr frqfi fl sitr o.zrd t EA€ fun qi Item ol ire ori
Selectedltem d tui tuq qror Br
ar fff or ,{itr Item tr(Rfo @G A ftn Image 1ir= ol
ire o€ d fti loq qo t
smalllmaselist

Methods DescriDtion
Heginupdate gs iprE or qdtq Conhol o'l Visual Upading d End
update €li oo Tumotro{i A ftd fuqr qrfl i
gfi iqs oI cdq Control d 1id Visual Updahng o)
Endupdate Reesume ori d 1ili fuq qror B
Es tsr-s ot q+q Icons d Large and Small w i rcRlo
eri d tui tuq qror i r

Afangelcons ff iqs @1 r+,1 s1fl Items d Clear o€ d ftd fuq qldr


B
Clear

Events DescriDtion
AfterlabelEdit q6 Event and Trigger tlo B, qq Label ol fu!,e fuq qldl
tq6
BeforeLabelEdit Event Label A fur,z ai r] rrd Trrgger dor i
q6 Event nq Tngger Eldr i, qq item {ftzic Eldr B
ItemActivate

Prepared By-Nltendra Tomar Page No-37


Exercise
Pr:ivate sub Listviewl selectedlndexchanged Listviewl - selectedlndexchanged
1l LisLViewt.setecLedJndices.CounL > 0 Then
TextBoxl - Text : "You Have Selected" &
(Listviewl - Selectedftems (0) - Text)
End If
End sub
Private sub Ruttonl Click

Listviewl- Items-Remove (Listviewl-selectedltems (0)


End sub
Private srrb Form4 T,oad ComboBox'l - Ttems - e Icon View" )
ComboBoxl - Items - Add ( "snall Icon View")
ComboBoxl - Items -Add ("List View")
End sub
Private -srrb ComboBoxl sel ect ed Tndexcha*ed
Tf ComboBoxl -selectedTndex : 0 Then
T,i stvi evrl -Vi evr : Vi r.JSTc
Elserf comboBoxl - seleCiledf'&ex'<-rfl lGEh
T,i stvi evrl -Vi evr : Vi I con
Els e fl

End Sub ",,o


ll""""' ""Pdo-.#c+1"

Pri vate Sutr Button2 C


i stvi ew] - Che
T
End sub

Trec View Control

Tree View nodes dl w Hierarchy o) tr<Rfo oG d fut loqr qror t, mt d$ Child nodes qFqfu(
dit ael {sd nodes d fE dl Rffirc ol q{ Tree tpn {sd Branches d spl r<Rto fuq qr
sqor tr iew Contrcl Iters oJ [d (ffi t r<Rio oro B t dS windows E4lorer Window d left pane i
w rH d hierarchy r<Rlo rtfi t r

BorderSt/e 5s fff or cql.I Tree Views d Border Style o) ie oG


d ftd flq qrar t r

gs frqd or rqlq Tree Nodes d s{ oieli ol vrw oG d


Nodes firi foq qar B
gtr fuf or yqlq Distance o) ie oG d firi ftq qror tr
figq rdo a{d indent *+ qE} r

InileIlt gs fuf or yd{ Selected node oJ nc oG d ftn f6qr


qror t r

Prepared By-Nitendra Tomar Page No-38


SelecterdNode

Forms and Controls d {Jr"J GUI hogranmg

Properties Description
Softed ds frcdl i yritq Tree nodes oJ Sorl w i r<lifo tnri d
Iid foq qo t
eq fff fl qd.r First Vrsrble Node ol <qli d ftd fusI
TopNode qror t t

eq riqdf or rdm ies d tsr3i ol Court o{i d ftn


Visible Count t
fuq qror d Crment sc n im tr M
Methods DiscriDtion
Begin Update qs iars Tree View d Redrawing d Disable oro B
EryandAll q6 iqS sli Nodes al Exland oifl i
GetNodeAt q6 ners A Tff &rr w Node ol get oror t
GefNodeColrnt

Events DescriDtion
AfterCheck s6 Event (q Trigger tlot i, qc q{ Node Checkbox o)
Check fuq qror i r

s6 Event (s Trigger tlot i, qq Tree Node ol Collapse


AfterCollapse fuql srn1 B
t
s6 Event (s trigger tlot qq tree node aJ Expand fuql
sror t t
AfterCheck i
q6 Eveft item A tuee View Drag €ti w Trigger tlo t
ItemDrag

Exercise

Private sub Treeviewl Aftersefect (Byvaf sender As


System. Obj ect, Byvaf e As
System. Windows . Forms -Tr eeVi ewEventArgs )
Treevi ev.r'l - Aftersel ect
TextBo:<1.Text : "You Clicked :" &
e. Node. Text
End sub
Private sub Buttonl Click(Byvaf sender As
System.Object, Byvaf e As System. EventArgs )
Handles Buttonl . Clic k
Treeviewl . CheckBoxes : True
End sub

Prepared By-Nltendra Tomar Page No-39


Toolstrip qlRa.r mo-4]-a
i t
Toolbar Contlol vb.net Window forms Application q{ qttcq,f o.da t
qs o-.;fs Form w it l or d rcRlo fii
r)ari Toolbars Controls or yo tfl
$Td +il i
et Aw o) 1ifte v<ms of gir o{i d Iid Short cut iar-s a) sqddl
t i
twn Toolbar Control aq Button combobox listbox checkbox gqd? @-utd al erlio o{ rrod vb.net 2003 t t
Toolbars control al rfq fuq qn en vb net 2005/2008 Toolbars control dl aw rdm fuq qot t t
i

ProDerties DescriDtion
Iterrs q6 frqdt Toolship Control t rrqEo q.ft item o) rehieve
ryfiit
q6 frqfi w iqal t o{fi i. d <{tfi t 1} ToolStrip
LayoutStyle control *item d Collection o) {".'rftf, ot,n
q6 frqdt Layout Scheme Chacteristrcs o) r)e oEfi i
q6 frqdl Toolship ParMl d Orientation ol ire orft t
Layout Setting

C)rientation

Method DescriDtion
GetNexltem s,{r ic.s fl
rqlq qo Specified Reference Pornt i Ne)'1
Toolstnp Item @'l Retrieve oG d lid rql.r fuq srfl i r

Events Description
Item Added s6 Event and higger Elf,r i, qq q{ {i Toolstnp Item @l
toolstlip al Toolship rtem Collectron i Add fuq qat t
s6 Event (q Tngger tlot i, qir Toolship Item w 1?f,o
fuq qror i
Item Clicked

Exercise

Private sub ToolstripButtonl Click (Byvaf


sender As System.Object, Byvaf e As
System-EventArgs) Handfes
ToolStripButtonl. Click
MsgBox ( "yoii CiicLe.i" & sender.Tostringo
End sub

Prepared By-Nltendra Tomar Page No-40


(1O Link label

ftio tao (Link LabeD! c6vB.NET i rgo or ord oro t dtuc qd iq rffiilr d tid ro qr<.f"f oEld +ir B rs
w otd o{i w r{ !q 1l {<rt nq w c{at ot sofl t
liro d{d d nirdlq ftn a{d a'l FrFf}tud mTdfu +fi i
> Active Link Color:- Active Link d oes o't ie o{i d ftd ss ciqd ol rqlq t erq qo i
> Disable Link color:- Disable Link ti oog d te o€ tb 1 ss ffl ol sqdtq i opr qo t
> Link color:- ]]rqqo lio d oos ol tre ogi d ftl ss ffl ol rdiq t olq1 qar t
> Link Area:- Link Area ol ite ori ti f rs ffl ol rql.r i drq qrfl i r

> Link Behaviour:- qFrrdKr: q6 qd i$ iq or ilc o{i d rnc sc$.r n erqr qm B, m Link Behaviour aJ
rqftlo 1dq q iid
> Links:- r,sd qEqq iJ Links d s{a al qw fuq qo t

0€-d€ @ 6'Etd

i
Status bar Conhol VB.net Window Apphcation i t
Fonn d Button 1+ra E'ldI t I s6 Control usel aJ \€Idlrq d
Folm dl Status infolmation dS Range nurnber, date and time eqrl? ErtIfl d t
VB.NET 2003 Status bar controli
fl qdrT laq
cql.r fuq 'drfl
'flfl ts i
VB rct 2005/2008 q Status bar Conh ol l -€fl co Stahls.lflD conlrol a qql.r '- qm
rn fuq ,i J t
ProDefiies DescriDtlon
GripStyle gs ffl
or rqtq Grip o't Visibility o) 1td o{i d tun o{d
t
w frrdt w tq d ie ryfi t qJ Statusstdp Conhol w
LayoutStyle itenrs o'l qqRs.il 6{fi t I

w mrJI noq d te o{fi B. ql Statusstdp control d 1al


Tool hpe ol <fd) i t

Showltem toolTipe

Table: Propelties ofstatus Stdp Control

qafqc a'Eld
i
Tool bars Controls VB.NET Windows forms Application q{ sdca"f tn-zta i i
w o-.jlo Form w il.1 or d fii
r<fito rto ir Toolbals, Controls or w i{]r sT6 dor sl 5w oi lnnlq
t rrqqas of ar ori d ftri Short Cut *-N ol
t
sq.r€r e{nT B VB. BET 2003 iI Toolbars Controls rq Buttons, Combobox, Listbox, Check Box o-.ira reii d
t
rqlio os rrod i I VB.NET 2003 Toolbars Co rols or qdtq fusr q[fl e,,l VB.NET 2005/2008 Toolstdp Conhol i
oJ Toolbars Corrhols or qdl.r l.r,=qr 'drf,r s.'I
Propefties Descdptlon
LayoutStyle s6 fff
Toolstnp Control il
rrqerir e.fi Items qi)
Rehive orft i
Layout Setteings rs ffl
q.F nq al 1te offi ql <{tfi 1} ToolStrip
t i
Conhol d$ Itenrs A Colection oJ {"-'rfq( oir
(Jrientation qr frqdt Lavout Scheme Clnactelistics aJ ird @{er i r

Q+frfuq r6rt d DialogBox m) q{glidl I

ctm- ofqi GFrdifrr Cf6s s-<ldr :- ft^ff .it !ffilrr n 3rqi wffi3n d od o{i A ftd rfuq Elqdi.r d'{r rsl=r s{fl
t i s1qdi d'{r ftsslq i oqqr qqq fi dA t, g.sfd st qnqc sqdTr d4H sd q[fl B VB.NET i {q{ As dl Fr d
alBq oG A !l< dt 5,r oiqr srqdi,r dds or swifq or qron i VB.NET i liq tr{Ir A addr Efi i
(1) 3itqr F19d g1qAil ciRr (Ope[ Frle Dialog Box)
(2) +c .r1'.r sqd'r ciRr (Save File Dialog Box)
(3) ,nl€ sqdil qiRr (Foft Dailog Box)
(a) od{ E1qdiq d'{r (Color Dialog Box)
Prepared By-Nrtendla Tomar Page No-41
(5) tq te3rc sqd'q qiRr (Page Setup Dialog Box)
(6) ff< Ers.fq tfiw (Pnnt Dialog Box)

(7) ifl sqdi qiw (Help Dralog Box)


(t) stq{ qrrd crqalT iYffi (open Fite Dialog Box):- 3fion{ldrd{rr s1zr qlEd d rreqq t lHt] o{fi i rirftd qr{d
al 3icr oii dl 3nqcqofl €tfi ir cE od VB.NET t Open F e Dlalog oda d qpqq il fuq qn t f(] @dd d
qpqq r] ftxi ,.rt etgd ol riqc o{d (trrn n rqtq fuql qt qefl t
siqrl $r$.d sr{rdtq ! iffiq ,- si.rr qr.rd srqdfq dw i o{ niqdlq +fi t ffi Ergt 6q openbox aJ qd ir rrit r or
qoit,
> Add Extensioni g$d Frir ft,1n,i fu .li ctr?<Fr d .r1sd al 3ilqr fuqr qr $.D-dr t
> checkFileExists:- qR {qi ftxlrt{n w.sd ol erlqe orm i s) fu sqoer qfi i oq qr iiro r<Rfo oror tr
> CheckPathExists:- e+ qw.roo wvir to t oq cE cfi:[drq$ +$q iar tr
> Dereferencelinks:- qa {Ir'oe d s1er ord oror i
> FileName:- q6 s1qdiT dffi i Rra€ o'l rd FlEd or ;]1q qflar t
> FileNames:- q6 q{ {ts 3rffi mqd i {fld Fr{r qd)qd w5d d Rra€ ffqr qr {ddr t nq qr sq sqd flq d
r<Rfo oror i
> Filter:- c6 t< F .rd d flq ol qilnl i s) fuet rlor r,< $ t
> Multiselect:- c6 qfuqd Rri{lrr ol .EqfA ifl i
> showhelp:- s,sd gm s6 ffirq srfl i fu sqd.r .i{J i iq qec a i,n q {&
> Title:- tsd FRr slqdi.r d'(r oI efca ftq qror B r

drq qrrd s[{dt.r d lrrE ,- s{{i oJ ro]a ror{ o't i!..s €tfi i dr FlEfttuo B,

> lHq (Dispose):- qr siqr €rqdi T d'wr d ErlI trd{ ftd qd qd ffi al ds tnr i
> 3iqr qr{d (open File):- s,s$ {qi d E]11 RIa€ o'l rl{ sr{.1 al Read only ftrilwr d epr elor qror B
> tire (Reset):- -rcd em ritqc s1qdfE d{r o't g.Jt ff1q o) {fte tnq fuqr srfl i
> {i srqdiq {show Dia log) r r-trd em gr+oi r dw d iq qr so(r t r

gnTn srid <r{df.r d Eie , Eqd s,ie FlFtutua B

! qr.rd ffi {File ok):- q6 e,ic gs rrqq ard o{fl t w< 5w erhr w iq q-r w f4do .trl(r ir
> iiq ffiiz (Help Request):- e< qr ie rel w fuo oEor t cJ gsr {rqq qE ord oEcr B

Prepared By-Nltendra Tomar Page No-42


f,xercise

Private sub Buttonl Click(Byvaf sender As


System-Object, Byvaf e As System. EventArgs )
Handles Buttonl . Click
If OpenEileDiafogl - Sho\..rDialog 1) <>

Windo\.,,s. Forms . DialogResult - Cancel Then


PictureBoxl - Image
:Image - Fr.omFi 1e (OpenFifeDiafogl . FifeName ) End rt
End sub

O) tq sEd €Edifrr 6dd (Save File Dialos Control):- ft^jt fi rorr d qrsd o'i S{tuf, oG A fti VB.NET d }.<{
q{ ftdN Efrr,r dfi tr qw ftxll ron o't qr.fd dl {,1 erEq w iq o{ 1]o(r t
irq "Fr{d sr{raf.r o+d qn ffiq ,- iq qrgd srqdi 6l frqdlq e-r,r.r 3i.rr q .rsd srqd.r d sqtq dr+r t afuc asn EE
3rq fr'qdfq al ,.tt qls rur t ,

> Add Extendion:- 9sd Frir Tflr:iFr dt w5d ol eler q qoo B ft{Jor y{rd{rr ftql rur i
>checkFileEx;sts:- qR {qi Ii^fr !{n wEd ol iq oi.n qror B d sqder qfi t, oq q6 +irq r<fifu o{al t
>checkPathExists.:- c6 w +flq{t +irq inr t e< qr* .roo w ir in i r

>DefaultEtxt;- c6 Mae qI.d T{r)ir.i d r<Pio oror B


>FileName:-q6 slqdiT d{J i Rri€ o't.r{ virso or flq Eflar i
>Filterlndexr s6 ote qrrd A ftr@ft1 A ftd rdlq n orqr qror ir
>RestoreDirectory:- e,fld fl{ d€ cr${€er qi {< o{i A qri ft riq t}q qar t
tq "Fr5d €rq.dif.r d tirs ,- iq .],lra s1qd.T d is,.ss ril.rc wsd sqdr d nqc fi dfi t ,

! ei.rc q15d (open File):- ard rm qrt d rm ftrie o'l {d F19d a'l Read only trilrf,r d {lF{ slor qror i
> t$e {Reset):- e{rd Erir its sqd{ qiRr o'l s.Jl frqd-fq aJ ftSd oi ftq srn1 i
> yi srqdiq (show Dialog):- tird Erir srqdi T d'{r ol ier q troo t
tq sr{d €Fdf.r 6drd d di" ,- rtrd sie r?lFfitud t
! qrsa 3rB (File oK):- c6 gie eiqc q t{c {ei w fuo ori w ord oEor ir
> iiq ffi(? (help Request):- qq tq q-r w ftf,o fuqr qln t oq qe qic fl{ o{dr i
(3) si€ GiEalq a'd]-g (Font Dialoq Control)! qite srq"i.T ogld d Err rq 3rqi fusq w scdel e'lr ron ti de-s o't
ft€ al is {oi t
qt< srq"fq d+d al mTelq qle sqA'r aEld a't Flqfufud ,M1s i
> color:- tfld sr{r {a{ A E]]1 ftId{c ftA qi ros ol <qfq qo t
> Font:- c6 {i{ FrRr ftI+f,c fttn .rn q'r€ oJ <{rldr t
> Maxsizeiqd {4{ qm Rrie o't w soi ErA cn€ edq al r<frfd o{dr i
> ShowApply:-'.rrd Enr !E qdrsr qfl i ft ql€ s1qdr d{J i Applyq-r al rq qri-r q q8r
> Show color:- gsd ElI q6 qflqr qIfl t fu sqd.T dN t rtrdi dro oJ rgl 9lirl1 q {6,I

Prepared By-Nltendra Tornar Page No-43


>show Effects:- r-sd trRr rE cflqr qldr B, fu sqAil d'w i gdqz dfi Striketyrouth, Underline 3lR text color
.:iixr<r ol sqr qt n q {&
> Show Help: rsd qr{r q6 {f,TqT qTfl B 1} sq"i.r niqs t t"q cec al {sr qt,n q {S
qte rgFr"if,T oE)-m d tprs ,- .rl€ src"fn d<rcr al n..s FrEftfuf, i
Reset:-asd sr(I sqdr EiRr o't II,i riiqJto o) 1t$e or ftq qq t
>
> show Dialog:- tr-d drr c rerr " ,r i )o ,-cr ) t
qt€ sr{dY.r 6+d d dlz :- qil€ srq.ri,r diid A Ene Frqtutuo t
> Apply:-qq apply {-r w fA.ro fucr qo t oq qs gie ori oror ir
> Help Request:-q.r ifl .]i-r w 1+f,o fuql qo t oq qt s-ic ord o{dr tt

Privar,e Sub Bur,1'onl Cfick (Byvaf


sender As Sysr,em.Objecr,, Byval e
As Sysr,em. Evenr,Args ) Handfes
Bu1'1'onl . Cfick

If Fon1'Diafogl sho\,,iDiafog <>


.
Windol,,is . Forms . DiafogResuft. Cancef
Then
RichTexr,Boxl . Fon1' :
Fonr,Diafog1 . Font
RichTexr,Boxl. ForeCof or

EncL It
End sub

(a) 6trr cT{dYrr 6<ld (Color Dialog Control)! as oqJd d rlsqq t ftltrq Color qm liri q soi t
rtr{i s1qdil aEl.r d-t fr'qdfq e{ srqd.r a't {J ff1q ttfi t ffi qs aq s$ sd t rdFT s{ sri i
> Allow Fullopen:-tsd qEqq il {4{ o{zq od{ dr ltql.cr d{i d lid srq.ri.T d'Nr a) sqql.r i dr s{dr ir
! Color:- rrrd qEqq il5e< ro< ol Rrie os rroor tt
> custom color:- tsd qEqq ri {w orzq od{ ol te os so<r i t

> Show Helpi s6 oal{ srqariq d'{l t {IsEn ll€rqf,r r<rc s{fl t
6ff cr{dfrr 6<)-d d tirs :-
> lt$e (Reset):-e{rd Enr srqdnT o't q.n niqjtq ol RSe tnq ftq qo i
> €Trel. (Show Dialog):- .,? d|l] srsT, d ;G )
'l
oos g1qA'.r a<ld d rie ocr sq"iq oiro ti ene F]qfufuo i
> t q ffi€ qq ifl {-r w fuf, fq,qr qrfl i aq qs cic ord oror t

Private sub Buttonl Click(Byvaf sender As


System.Object, Byvaf e As Syslem. EvenlArgs )
!i* 1y34rir* Handfes Bu1'r,on1 . Cf ick
If CoforDiafogl . sho!.iDiafog <>
Windor.is. Forms. DiafogResuft. Cancef Then
Labefl.Text : "Here's My Nei', CcLcr"
Labefl.Backcofor : Cofor.Coraf
En.l It

flEPdEu Dy-1\[EIud rurn raBE 1\u-+q


QS Context Menu t fls flr qIl{A iI
Ans- contef Me rd merNs6Ii t d Controls vt Popup 6 w tdi i ETqrqm, q,r6qE{wqrssERr Riglh Click
6{d t d i conte>d Memrs o6d i t t c$fu i Speci! Conhols d sq{ troe di t t]Iqrqo, Controd men.ls, Controls
Specific Option St Cut, Copy, Paste {drfa o) r<Rf( oti d fi{n eurt I fd;i qi B Contei Mernr ol Create ori d
Ii{i Conte{ Menu stdp Conlrol or c+.r ot s6A i r (!-n { t d q$s ori d fid Meru Commands ot rSq o<t ir

Prepared By-Nitendra Tomar Page No-45


Vis'nal Basic.Net

Unit-4

Ql-Object Oriented Programing $ er rrril t I yficn fiF-q frc}[(]I{ isqsrsi I

Ans- ffi€ r @ rffiq ffietr or rqtq d{fi t GE, afl$ a**,-.,;;)


@l gfi Instance dfl i qo wm, Data Flelds and Methods + lido{
dr .)+ t OOP i qir, 'r ")F {ei . += A #r .d P re z^\ t
srer ol frils oG aqr iiro d M A ftq rTrr Elor 6 VB.NET q f"***")-
. q,'T. 3, {* rrft qr sIs 6?, fr . \-__- I ""-""
I
l*
1-Classes and Object.
2-Encapsulation.
3-lnhedtance.
4-Polyrnorphism
\:ll2
5-Abstraction

l-Classes and olriects-qo q"ffi o+fl dl n=i6 dfr t ql gzr iqd, iqs .r.ro{s si{ ({rer {dft{ al {qfi tr
t
c{ Class VB Language d ftd vrsFro Burldurg Block gsor srpJ t ffi vB A {Jpr od o{i A ftri 3rqdl Classes fu!,e
oG o'l soEo rldt :nq Classes template d fl6 rfq or sod i r q€i w Methods and Attnbutes rides d rro qq d
i
fr w t
Bu dmg Block sffuq fui sri en ir w
Terplate or cd.r
dds
3ndq-{r a'l fu\,e o{i d ftd locl srfl i Class w Self Contained q.lqlq
ol cR,nftf, o{i d 3Eqrn tfi t
6q q.Jl etrqrrrc ol ozto osi t r

t
+r] VB.NET Program aq co Class Student d qrq fu\d @{.lr q6i B dt
.al rl! =F?-? q i i l lr
Public Class<Class name>
,_G.--*r__
L"----..-l &
-
Class member
End class

gs class o,r Irstance sf,d€ ol ffiqs o{i op:r Instantlate o{i or yrsc Fqf}fuo $c i dor i
Dim<Object Name>As<Class Name>Declamtion
-

<object Name>:New <Class Name0>lnstantlatlon --.t'*1 .--


M
2-EncaDsulation-OoPs

Pdvate members vds or


Encapsulation q{
Class sI Object
i
Encapsulatio4 Data and Mernbers o'l Class
Wrap Up oG o'l sful t A{d Specific methods qI Prope ies ol Class d

Unautho zed Access r] glTi d qo yfuq


({ri ir<) aq oe qoi fu
soi t
d
i
Behar,ror and intemal state aJ
i
i

qqq t qo Child Class rrqfi Parent Classi


i @
@
W
r
3.Inheritance-lnheritance,o frqdl i, ffi Baso Claaa
qfufi\o {],ft ffi d !lw oq safr t Parent Class q6 Class dff t d qffi mcJtq dr qd{r
difi i, 5d Base class,fl osi t osn Child Class q6 Class tlfi B, sJ s.cff Base Class dl
mqdf a) qflt{r o{fi t, gi) Derrve Class
"fr
oaitr fil
tt Dorlvod cless

4.Polymorphism-Po1),morphiu4 oop or cfi TrTl Concept t Polyrnorphism dl raro t ri w Single Procedue o)


o{ sc n rdq o{i B Pollnnorphism d r5u ffi
Fr.-tutuo t
rqa cfi {tr d Method d ftq f}q Impplementations o) Classes i scdq o{dr B
zqs co Class d tprs aJ Ii+ Specrfic Implementation d oSrf iat B
Polynorphism d ron o'l €ifi i
r Compile Time polyrnoryhism. 2-Rlm Time Polyrnorphism.

Prepared By-Nltendra Tomar Page No-46


Abs'traction- Abstraction li^fl Partrcular Concept sI ffi€ A
fr=€4i{nq-a] Ecrrr apr d{d 3nqrqo q1q€ d <nli d qF6qr B
OOP t Abstractior, backgrormd details @l qFqfAf, ftd ftrl
enqrqo ffi d act d lqq orcr B Classes, objects {flrl? aI
ffie ,Abstracdon d fi sqlEr.I Bt
Q2.VB.NET t Console Application of f$ fuqd fii t r

sr{r{i r

AnsVB .NET t 6q Corsole Application d low os soi i t Application Command-line w 3nt,-rR( dd B, cpll Dos,
Mndows dt] elqtEq ftiEq r{ {r +fi t Corsole Applicatron ol fuw otid ftd F]qfAfuo €v or crgut"i ori B

Stepl- Staft=All Program=Microsoft Visual Studio 2005/2008 qs fuo ori t dtr q{ Visual Studro 2005/2008 a'l
!!]q {dl{ rffif( dfi ir Menu Bar w rcRfu File=New Prolect DialogBox r<fifo +dr t {si Project T}?e pane t
Visual Basic ol si€ o{i t, esd c{qm Tenrplate pane i Corsole Application ol sd< ori i t

Qt!'B.Net t c6 Class cr ffie al d€ fore foq qror tr ersrEi r

Ansc{ Data members and data members g*)s oG d


Class d ftn, s{l Class oI 3iid€ l6\'e orcr s.lqrqfi Elor it
B{r 6 6q qo nR\'{d l6\'e oG B, {S
6 6q Class T}?e @r w ffi€ fur'e o* soi tL F]..]fufuo s<r6iq it cfi
Console Application fu\.e fuqr B,

Imports System. Cons ofe


c Cl ass Cl ass'l
Prrhl i

Private dvafue As Integer 'Data Member

Pubfic sub Ner./ ( ) 'Constructor


dvafue:2

Pubfic Function Vafue O As Integer 'Memher Frn ct i on


Return dvafue * 2
End Function
shared sub Main o
Dim x As Cfassl : Ner^/ Cfassl 'obj ect
WriteLine (x.vafue O )
ReadLine o
End sub
End Class

Q+Vb.net{ Constructor flr t ? sfl. qlFd rTsr{i I

Ans-q{ Constructorqo i"rE t fui (q eid fu{{ qlfl t, qs w offi€ sn q A q{ fu\.e ftqr qm t, go Conshuctor
ar fiq 3nd€-s @) sfiPtqflsq oG d ftd or sod ir np.,r tirdl-d d $e or sot B ssd spr fi 3 qi-.-s ol Accept
o{i d fun !fi Constuctors a'l fus soi Bt Flqf fuo s(6{q t Conshuctor or wil oid Console Applicahon o)
fu\.d fq,qr rur t r

g(l-(vl
Imports System. Cons ofe
Pubfic Cfass Construct
Pubfic sub Ner^/ o ' Cons1'ruc1'or v,ii1'houl, I aramel,er
Fn.l srrh

Prepared By-Nltendra Tomar Page No-47


Pubfic sub Ne!./ (Byvaf Nane As String) 'Consr,ructolr r.iithone Parameter
Write],ine ("Nane is:" & Name)
WriteLine ( ' ')' . . . . . . . . . . . .'

End sub

Pubfic Sub Ner./ (Byvaf Name As String, Byvaf Age As Inleger)


' Constructor riithTrio I'arameter
Write],ine ("Nane is:" & Name)
Write],ine ("Age is:" & Age)
End Sub
shared sub Main o
Dim objl As Construct : Ne!./ Construct ) 'No I araneler
Din obj2 As Construct : Ne!./ Construct
Dim obi3 As Construct : Ner./ Construct . o. \ ro
ReadLine o
End sub
End Cfas s

Q5. VB, NET t Destructor t ors flr rrsd t I sr{r{i I

Ans-Destructor, Constructor d Opposlte 61fl tt qE Tfi irrE s-$ oq oie fuq qn $, qq qfi a't 3llq{{{dr {fi
t ffi€
r)fi Destructor o crq
t qS Elf,r i, q
classor; 6ifl d
Deshxctor dr fu\,e dii d ftn Fqfufuo d ip,rgt] sqdq
t
i
1 -Finalize Methods

2-Dispose Methods

l-Finalize Methods Finatze Method c{ cfraie d Free Resources a) Attempt 6{i d 1id Allow or+ t Fr.-ftirtf,
s(o-iq i Finalize Method or rfq ord Cosole Application d ds d icoc fuq .qr t

e,s @)s i Finalize Method tn vqlq fuqr .Rr t, E) Deshuctor aJ fur,e oro tr esd RqI F5 key Press oqd qfrn
ol sc a{i i
Pubfic Cfass Cfassl
Private MyName As String
Pubfic Sub Ne!./ (Byvaf Nane As String)
MyName : Name
Consofe.Write],ine ("Cfass1{ 0 } ", Nane)
End sub
Protected overrides sub Finafize o
Consofe.Write],ine ("bye {0} ", MyNane)
Consofe. Read],ine ()
End sub
shared sub nain o
Din obj As Ner./ Cfassl ("satish")
Consofe. Read],ine ()
End Sub
End Cfas s
2.Disrrose Metho& Dspose Method d c*q d Er{I ql 6q Destructor aJ fuqe oi Foi i t

Qcvlr.net{ Inhe tance E} s<I. qffi qq$Ei I

Ans5qifr'{ Inhedtance,ooP ar !T .ffi fr4{ i q6 6i Exrtsting Code oJ Reuse ori d 3r{qid i.r i sfr q'I4i d
qpqq rl ro Class d riqdl ftxi qrfi Class i Inherit d qofr t 3r!rk qo Class 3rrff Parent Class qit yiqdls d qd{
os rrofi i sJ Class 3rrff niqJts or rd{r o{ffi t q6 Class Parent Class and Base Class €ifi i e{ qJ class 3lrff
Parent Class d ,iiqaq a't qds d{fi t s6 Class, Child Class and Derived Class rlfi t 3rqftfuf, s<rEwr i cf,
Corsole application o) fu\'e oG A ais ol <cfu rur i, ffi Inheritance or vrjtq fusr.qr t
Prepared By-Nltendra Tomar Page No-48
Pubfic Cfass Parent
Pubfic Sub P1o
Cons ofe. Write],ine ("Parent P1")
End sub

Pubfic Cfass Chifd : Inherits Parent


Pubfic sub C1 o
Cons ofe. Write],ine ("Chifd C1" )
End sub
shared sub Main o
Dim c As Chifd
c: Ner^/ Chifd
c.P1o
c. c1 o
Consofe. Read],ine ()
End Sub
End Cfas s

Q7-VB.Nett Overloading GII Overriding 6] s(I. €Ld sT{r{i I

Ans-qHBrrVB.NETwfiaredr-qdnrqwt3rE{n?rEolfu\-coGdt3r{qidifltssfrq*olt..s
3i{idrfuq o6i t iw siutilfu.r o< rd,T a't srdr i, qq c{ dS ltq d Nrqtr d }.rq{qoot c{ fi o!6 A Task ol r*ciid
o{i A tun ++r t dtur r+n r--qe ffi Flq di Br w 3fqiiitu r ivg d s'lr sy c{ Single Method Name o) tw
o{i iafur o-n{i-.es d Number, Tlpe and order i Fi< i t Flqftfua ssr6r.r t nars 3ffiRr or rdl.r ord q{
Console Application ol l6qe fuqr .qr t

Pubfic a, b As Integer
Pubfic c, d As Doubfe
Pubfic Function nuf(Byvaf a As Integer) As Integer
Return a
End Function
Pubfic Function nuf(Byvaf a As Inr,eger, Byvaf b As Integer) As Inr,eger
Return a + b
End Function
Pubfic Function nuf(Byvaf d As Doubfe, Byvaf c As Doubfe) As Doubfe
Return d + c
End Function
Shared sub Main o
Dim res As Ner./ Cfass4
system. Cons ofe . WriteLine "overfoaded Vafues of Cfass Muf is::")
system. Cons ofe . WriteLine res.nuf(10))
system. Cons ofe . WriteLine res.nuf(20, 10))
system. Consof e.WriteLine (res.muf ( 12. 12, 13. 23 ) )
Consofe. Read],ine ()

Method Overriding lrilqtllrBrl

OOP aI qo Basic Concept q6 t i


fu 6q gf, Base Class Virtual Methods fur,e os sdd t
qJ Base Class dl
Frmctionality ol change ori d liri ro Derive Class o) Override oro t
c6 Concept Overidng o6dnr Esd t fti
Override dl cd ot rqlq ori t t t{n o{i d fun Method ol Base Class Override i oG qrlti Base Class
f*qs t
Override dl qg <rl1fl t 1+ e-s nqq d i
Derive Class Ovenide 1=oq rut t
s,S o!6 Derive Class Overrides dl qd i
qr <cffl B fu w Existing overide Method ol Override os {6r ir Fr..]fufuf, s<r6i.I t oveuidding or lrql.r 6.d
Console Application ol fuw fuq rut t Ovemdmg d Late Brnding ot sffiertl .ft o6i i t
shared Sub Main o
Dim empfoyee As Empfoyee
Prepared By-Nltendra Tomar Page No-49
empfoyee : New Manager
enpfoyee . Work o
empfoyee : New Empfoyee
enpfoyee . Work o
Dim manage As Manager
manage :
New Manager
manage . Manage o
manage . Work o
Consofe. Read],ine ()
End sub
Cfass Empfoyee
Pubfic overridabfe sub Work o
System. Consofe.Write],ine ("I am an empfoyee.")
End sub
End Cfas s

Cfass Manager : Inherits Empfoyee


PuL,fic Sub Manage o
System.Consofe.WriteLine ("ManaSing ... ")
Pubfic overrides sub Work o
system. Consofe.Write],ine ("I am a manager")

End Cfas s

Q&My Base and My Class Keyword * elc er {T{i t r

Ans-My Base keyword

w Derived Class i Methods o) Overriding ori qqq o:.r go Base Class { Methods oi qds ord {qq Mybase
keyword @r trd.r o{d tr dS 6q w Derive Class o) Design o< € Bi .i Base Class t Inherit method o} Ovenide
ord t t ts case i MyBase keyword d rfq d EriI Base Class t Overridden Method original Method ol oid oid t
s.qfafuf, s<r6i"r i w Corsole Application ol fo{e oG er o}s <{fu .rqr t fui MyBase ke},rvord d ,qi{ ol <ffs1
rur Br

MyChss keyword

MyClass keyword w i
Overridable Method o) Class oio oro B t qa Class Method d t gffiyrl al qt {RiP{d
otct t i go qq Coruole Application o1 fu\,e o{d B, ffiM}Class keyword ot rqtq ord i t

shared sub Main o


Dim p As Parent
Dirn c As Chifd
: Nel, Parent
p.P1o
- p.P2o
P: Ner"/ Chifd
p.P1o
Consofe. Read],ine ()
End sub
Pubfic Cfass Parent
Pubfic overridabfe sub P1o
Cons ofe. Write],ine ("Parent P1")

PuL,fic Sub P2 o
Mycfass. P1 o
'Impfementing keyword MyCfass here teffs aff derived cfasses to
reter to the
Prepared By-Nitendra Tomar Page No-50
'base / abstract cfass riherein the ]:errjord Mycfass appears
End Sub
End Cfas s
Pubfic Cfass Chifd : Inherits Parent
Pubfic overrides Sub P1o
Cons ofe. Write],ine ("Chifd P1")
MyBase. P2 ()
End Sub
End Cfas s

Q9-Vb.neti[ Accesss sTe{ifiers al v<T. sttr( qlrgrfi I

Ans- \rS€ €fr,*Fo.if

Access Specifiers ot s"fr, q{ riidEe cp.r s{d Membels d


AccessibrJrty d rolc d s. fuqt t qo i Access
Specifiers or rdtq osd cfi Class d .Iq{ .ffi{c d rdq o'l FFierd o{ soi i r VB.NET ge ss r) crq troR d Access
Specifiers o,r r+l laqr qm i
l-Public-pubhc ar Eo Comnron Access Specifer t r.$ odi t .it qd{s l}qr rn rroo i t 3rprJq ssi Accessability a't
ald €q {fi B Accessibrlrty or dtv Class ti irxide and outsrde ,.rt drf,r i

2-Private- ts Access Specrfier d


AccessrbrJrty oi eilv frfto +dr t q"rJ( Class d inside tlo t fui n fkqr fti
qd i Pnvate members Class ti outside qd{ {fi liti qt qsi i t

l&!E!ElL r-{ Access Specifier dl Accesslb lty or q.orc t frtto dfi t 3r"rJq {fl M d wls nqr r-{fl) Dedve d
.rfl it
wm rd{J fuql qr nofl B

!E!l@!t Frend Access Specifier d ltJrq n qflts fuqr sr {rofl ir .it gsd ffi{r ol rqi on"r Same Assemble
Level t ,]t qclq o{ sai t
eq Dim d q€ d rq1.] qs Friend d qd rdFr iw sot t
AProoected Friend-Protected Fdend or Access level fi Specrfiels Plotected and Friend i ro dst tlo B s-S same
Class en g-qr] Inherrt d .rff i class t \'flis ftqr qr {l+cr t Access Specifiers or rqlq gs sc t Inheritance il ldqr
qfl t sprJq qq 6q Class o't frqJl o't same Class qr 5'sS Derrve dl .dl class i rlqs orcr i I qq 9-i Specifiers or
rqtq dG i "lEi
Private li'riend Protect Protected Public
Friend
Sarne Class

Same No Yes Yes Yes Yes


Assembly
Child Class
Same No No
Assembly
Non Child
Class
Different No No
Assembly
Child Class
Different No No No No Yes
Assembly
Non Child
Class

Ex- Create Console Application and Create Class Name it as one.vb and Write the Following Code on it
Imports System. Cons ofe
Pubfic Cfass one
Prepared By-Nltendra Tomar Page No-51
Private sub lo
Test
WriteLine ("Private Method" )
End suL,
Friend sub Test2 o
WriteLine ("Friend Method" )
End sub
Protected Sub Test3 o
WriteLine ("Protected Method" )
End sub

Protected Friend sub Test4 o


Write],ine ("Protected Friend Method" )
End sub
Pubfic sub Test5 o
WriteLine ("Pubfic Method" )
End suL,
End Cfas s

Creatc ClassName it as two.vb and Write the trollowing Code onit


Imports System. Cons ofe
Pubfic Cfass two : Inherits one
shared sub nain o
Din obj As New tno
obj . Test2 o
obj . Test3 o
obj . Test4 o
obj . Test5 o
ReadLine o
End sub
End Cfas s

Crcate ClassName it as three.vb andWrite the Following Code on it


Imports System. Cons ofe
PuL,fic Cfass three
Pubfic Cfass three
shared sub nain o
Dim obj As New one
obj . Test2 (
obj . Test4 (
obj . Test5 (
ReadLine o
G-End sub
End Cfas s
End Cfas s

Create another Console Application Name it as SecondApp and and Right Click on Solution f,4rlorer and
Select AddRefrence Option and Sclect File Under bin Folder in FirstApp.Create Class Name it as four,vb and
Write the trollowing Code on it

Imports System. Cons ofe


Pubfic Cfass Four : Inherits FirstApp.one
shared sub Main o
D ^ oo A. \ew o.'
obj . Test3
obj . Test4
obi . Test5
Prepared By-Nitendra Tomar Page No-52
ReadLine o
End sub
End Cfas s

Select Sturtup Pmject in FirstApp Console Application and See the Res'nft and Open SecondApp and Select
Startup Project and Run the Pmject and See the Result

Q1GOLE al TTflr{{l I

Ans-!{@ ffi E g*FE r oLE or qpJ i. object Linking and Embedding, 3r!,fd wrol orsd w {6diiq A 3fid€
o] qwff lffirrq tfto oF t oLE Control Toolboxi 1iq.o dcr irgS Form qs Add o€ d liri qrdw i r) Drag
otd Form w Drop ord tt {fl Control d ttrrot t tr VB.NET Application i ms-word or dq$-d qr rs-Excel d
qftte cfi ftffi el fi fao os soi t VB.NET i OLEDB Contrcld qlEqq t6q s.ci {ffi+.ilr ol s1eristS fto or
troi tr dS qfi E.r VB.NET oLE Contuol d sarro il Ms-word @r d{qtse qr MS-Excel dl qd:fte o) ffio or+ qrsi
Brd isr or sod ir is1 oG d ftrn 6q qotfw t rl oLE Control d Drag otd Form w Drop ord Br rs o-.std d
qsqq t Eq Frqfufu( ord o) qo o*d i
r

r 3rqi !fr{{ t qo ffie d fti fuer al fu\,e oit tr aq effi.rc ol fuqe o{ rrot t, d rc zrgq OLE o+fl
o-ela d spr roz dd t qr Eq liq &E a) OLE o+{r o"qtd w ft.-o ord B, sS Mc d gqq ceo sod t r

z 3rqi !ffirFr i Linked Object ol fog o< soi t


r

3 OLE o+fl ol sreris t Bind o{ {rot t

a OLE {+fl o+d i ffi€ ol \i{ ffo o{ trod t t

s Clipboard t oifi fdri.rt srer t ffie ol tuqe o{ s{i t

o ffie o] Icom d $c t trERio o{ sod B I

Prepared By-Nitendra Tomar Page No-53


Unit-5

Gl Data Base Programing flr i ? I ADO and$O t <qft €Tflr{i I

Ans srertg Mtq-srei+s or {llllxq e<l n spJ, {fl@d r{cfr[r or oiqflq i Database clq a] qfi 3iiffiE nqr
rz-ad w rzk o{o i, s] e1lcrqonEs1{ slcr dr R.Clq o{i o'l Sftql ol s.rder rFiri i srzri{ il sc srqi{iIl;l Tables d
$c i €l{ dffi t rdo Table, Rows, and columns or Combrnatron rlfi t r r.tro Rqig qd Row ol <qJo i cq rcio
Column q de ss fuid d Aftnbute oi <qlfl B VB.NET i Eq Window Forms Applicatron oJ Front End d s.r i
rqtq oG i a:.r sqi{J al Back end tool d sc n rqtq 6G i Ms-Access, sql, olacle qflrft ol sqi{ d sc t cIit r
oG i sS fi setts rffiq ord ir
ADO And ADO.NET { 3iirr
ADO And ADO.Net t qq eroq
3kla oJ Fqftfco &d llql
n r<fttd fuq rur i
ADO ADO,NET

1ADo, Comected data A sF{ ord o{m t s$or 3rpf ifu 1 ADO.net, Drscomected Database A $c t wl.r fuqI
qr szr irl d rnckFr d wl sti d rrqq oo srri{ d qrar qldl tl 3rprf( i{q Eq sq ol Cd{(] o{i t nl ADO.net,
oiqe rro t XML or tr+.r s{d slcr d w aiff {flfl t
2 ADo, w Marn object o) rvo -it dq sIeI d $. i 2 ADO.net @J Objects o) rt<r i d qffs o€
v) ri srer
rfq fuq qn t rS Record Set Oblect otd t i tJ {fi d flFl li ) FDala Sel -}," .El
seris ri ftdq.rd S'sd dr €R o{i 6t .iEqft idr t
3 ADO dqd Client side Cusors o) fu\a dii a't iEqfi
iflt 3 ADO.net, Ctent-Side and Server-Side qt <H Side
Crusors oJ futz tnri tfl .Eqid ifl t
a ADO, XML cifu i Records oi Persrslt sri i6l sEqfi
iflt 4 ADO.NET,XML or rql.r o{d 6qt ser o} pdmary

5ADo, slcr al qdIs o{i A ftd oLEDB and CoM aI


t
mean d $c iSgad dC a'l .Eqft ifl i
rfq oror t s ADo.NET, )CuL al rqt szri{] cp{ ic {€dr1q iJ srzl
6 ADO i Recor4 Set q{ S gle Table and Query Resr t
d Effiz o{i A ftn ci{e d s. it qql.r orol i
ds.irtot 6 ADO.NET Dataset i 1i l ql slzr qH t Multiple
Table qri {q s{dr t I

Q2- Server Erlrlorer d em Data fos ron Access fft-qr qtdr tl €qgrii I

Ans-s{r qtrElw 6r rdrr ord srer ol s*s 6rni

rq ftEd or rdq ftffi .fi Data Provider d Iid vo Comectron Shilg ol fuqe o< {roit i r srzrtir d sllr orq {{i d
ftri eq sreds ol oi+e o{i A ftn o+{I;l d ssgo €tfi i Server Erylorer A
q*qq r) glzr qflt{ o{i A ftd oJ os6 d Data Souce ib sp{ o+€rr d StrEl t
Server Explorer d qrt4q il s1er rdq o{i d lid FrqfAlird Steps al Follow ori t
.a Eq
LIE@
E :! safE
Stepl w {qr Mndow Application fu\'e did t trfltrqfl Server Er?lorer, form d +i { *r !rr??rs,ii?
tls r<Rfo tlo tt qR Server Erplorer rcRfu r=e +f,r t d View iq i t Server
Erplorer o) 1?o

o ori t rdc w Server Erplorer rcRfu t)ot i


Step2- tiri Data Comection w qrss E]{r fught IacIfi ori i op.r Add Connectron
g+ t +* tu Fqfituo l?a t <qfq qq i r

"l
Step3- Screen w Add Comectlon Dialogbox rcRfu +dr t e-s qiffi i 6q dala Souce d dJc d g+A i, ffi qfil

Prepared By-Nltendra Tomar Page No-54


rl+dlFr A flq Attach oFr q6i t Data Souce al o{i si€ d .a rr+q
Iid Change Button w ftd{ dii i, i
sqfm 1?q <qfui rur t
t
Step,l- qq 6q Change ral w fuo ori , Change Data Souce x
Dialogbox open dor t, qa rq Data Source qit qice oq troit i r

qa w rq Mlcrosoft Access Database o't Data Soruce d sc i areate llEE 5QL 5Erud D.t6h.iE

si< or rroi Data source d sdqz o{i d ,rq( ok Button


i
i
w l?.oo o*i gird q{4n Test Comection Button w 1}oo tnEd
i Test Cormectlon Succeeded d qpr vo itro d'wr r<Rfo dot ir dsr 1b
B[irfi fu, t vffitf, ]]q rur i r +Sq d{J d ok cac w o{i fu{ i I

..t.tunqe to.hoce3drre€rt t3$uE3ndhr


Steps- {sd T4n Add Comectlon grqdrr d{J A ok q-r w f6ro o{i i Eqt
Erit Add fuq rtqt Data Source 6qt {frtc a Server Erplorel i Add d srfl M..",rt fu;EbbJFi" otr po tEh-;I
i Server Explorer Wiadow i Server cfrqrc w fuo ord Add fuql .rvr Data
Souce iq qoi B ss a<e serilr ti qrpr di{Fr r!,.rlif, El qrfl 3rq sEri{ il t Etil;-t
s1er ol c*{r oG A fui 6q folm w Conhols sr d
Add a{i ir, fuJ
Ere
Controls d qtqq t
szlis it srdr ol qdc dG i r 5+ Retneve and Contols q5a Adnn

i i i
rsRfo o{i qfl w Data Gnd Conhol q.rrq ir srq oJ Form qs trERid ryi e:*tr'd
n5-".rF-,-d
i
Ed""...d l
G;; *;;;J " t *;a t
QlData Bound Controls ll Data aJ DisTlay ft fuqr qrdr t t srgrfrl t

AnsData Brndiq .NET dq{d d Erir sq.rer or[qT rw w voqe fr+* i s] client oJ data Souces dfr Data Sets,
Data Views {efa d trq oi+e oG d fui nefi .Ftrfl i Client A F,- i Er, trgs Visual elements Terlbox Conbobox.
DatacddView{etfiConholsitiControls,dataBorurdControlsdqqrJqriqiitrlrrnrr"riDataBindingii
dqc vo erq iqo) qo sqq t Control d qm vslii( fuqr sln t cfi clzl iqr] eilqo vo {rqq i vo i"1ot r<frfo
o{i d fun Data Gdd View Control d rdrq fucl srfl t I

Ex.-6q q w Gnd view Control or Use slcr Bormd Control d oqt ot i oe.,r ss,i e1elis d erq qit q<tito ot.J t srrd
i
Iid ADO.NET Data Components set qil sqarel iD{rfl B Components Data Bound Conhols (s,l Data Soruce A fis
Bridge o't oir old ori t i
Compontes FlFfifuo i
(l)Data Connectron (2)Data set (3)Data Adapters(4)Data
Connnands
rq s,i Componets d a qor t sqq).T oiir
Desiqn Time

Stepl-w r=q Mndow Apphcation a+t t {sn v<Rt( dr € Form w Gdd Vrew Conhol o) Drag and Drop ori t
Step2- Gnd View sw t a't
.r r<Rfo El € Arow w Ctck o{i i r ffii fu qq Data Soruce sH d 1id d'wr lisor
i
Step3-Data Souce aJ Select ori d 1id Drop down Button 1?do t
ori i t aqr Add ProJect Data Source Option ori B i fu
Step4- Data Source Tlpe il data Base Select o{i np.r Ne),1 t
Button i lfuo ori t
Step5- New Cormechon Button i ]i-f,fi ord aq Grid View il r<Rfo
rii qri DataSouce oJ rric os soi t r

Step6- Data Source Select ori d T{qtr Next Button w ]i-dfi o{i
Br
StepT-Table a't fF{
nlrr Finish Button w ]fuo o*i t
o{d t
Step8- t-fld T{4n Apphcation aJ Rrur o€ w Grid View it Data
Bsld ifl t
Rutime d Et<r data Grd Vlew i Data Display ori A fti ftIil
Steps o)Follow oG t t

Stepl-rfi r=lt Window APPtcation q+d t riri rsRfu 6l € Forrn


w Gnd View Control o) Drag and Drop ori i
Step2- 5flt vo Button Control o) Drag and Drop orit opI

Prepared By-Nltendra Tomar Page No-55


Button d click Event t fiffi code lilqd ir

Imports System. Data. OfeDb


Pubfic Cfass Forml
Dim con As ofeDbconnection
Din da As OfeDbDataAdapter
Dim ds As Datas et

Buttonl. Click
con : New ofeDbconnection ("Databs e Path")
da : New ofeDbDataAdapter("sefect + from tabfe", con)
ds: New Datas et
da. Fiff (ds, "tabfe" )
Datacridviewl . Datasource : ds . Tabfes (0 )

End Cfas s

Q+Data Base d flpr Connection Object, Command Object er Data adapter qtl use o-rqi Data 6J Insert, update
Gn Dclete 6ti fr cfuqr o\ srgrgi t

Ans-q.io Data base d s1pr dq tror{ al Activitv Cornnon ffi t r

1 Open a Connection-

2-Applyi0g a Statement.

3-E4ecting the Result

l-ODen / Create a Connention- s-(1 Process Database d s]9l Comection Establish oG t | {sd iAq w Class or Use
tlat t t fu Cormection Class oei t
Comection Base Class

OLEDB Cormection

Sql Coffrcction

C)racle Connection

oDBtlffiecfion
Comection qcd d 1iq {s Classes d Constmctor dl qs{d csfi t ffi
Comection Stnrng ori i t tt ft Database d
t]rq 3rdrr crd.r Comection shing Elfl B 6q qd q{ MS Acess 6 qIpl Comection qt} ssd liq Comection Stdng gs
rox t r

Ex Comection Striog

ProviderMicroso{t. Jet OLEDB.4.0; Data Source :"Students.Mdb"

2-Apnlyins a Statement- Cormection q{i d erEq ti Database i Statement Apply E{{ qsdr B i Statement fi ii
ito)J.fidtrofrtr
Select, insert, Update, Delete, cell to Stored Procedwe

Prepared By-Nitendra Tomar Page No-56


Database i Statement Apply a€ d liv Eo Command Class rlfi i r s] ss ro]a i

Connnand Base Class

Olodb Command

Sql Command

Oracle Command

ODBC Connnand

ssd ftri Eq Class or Constructor ss ron riro t


Connnand (Stmt as Sh'lng, Object of Comection)

lEsectins The Resuh-

Workiry With Data set- Comnand ObJect Data Reador t Information qi Store ori d Iil
Responsible tlo t *i
rfl{ Data Adaptor Object Provide loq qq i r fusor sqdrq i
Data aJ Data set T{i d lid fuqr qldr i I

QSOLEDB Gn SQLDB 6l €Tsr{E I

OLEDB(Microsolt Access. Oracle, I{YSOL etc.)

r-iror use SQL Server oJ slgor 3rq I]1lT Tol{ d Database t Data Access o{i A ft{ lqqr qor it r-si Microsoft
Access and oracle r5u i t g-$f,r qql.I sQL server A {JF{ }t fuql qI 1lo-l t rsd ft{ SystemData.oleDb namespace
ol imporl fuir 9rfl t 3ili E{rd <r< w$} Objcet use fu+ qm ir fd Des8n Trme i a-o<itm ci< r< edr i Coding d
rrrr use lAqI qm t r.iri ]i 1i Comrectiol Stdrg in rue fuqt qrot i

Microsolt SOL Server(SOLDB):-

q6 Mrcrosoft ErlI Develop fuqr .qr vo Data base SeNer Softwale i d a't RDBMS aJ Suppot aa.I t q6 SQL
Language sr use sI Data Accessing Provide oro it Mlcrosoft d {,li Programrning language F-iJ Suppofi oa Data
base d ftq use itr{ {]iD.rT t s6 ADo.Net r w rEc{,f Ers t ADo.Net Data Plo\.rder str$ fut s.d.r t q}t
DataAccessing Facilities Provide oEfi t s,S use oti d Iic s.ni T.{i SQLClient namespaceo) irnporl ori i ffi
IiN rmporls System data Sqlclient Statement tnr use fuqr er(r tr e-{rt liE Classes rlfi t

Q6. fi. fr. ol rrsr{n


(1)Dataset
-
(2)Data Adapter
(3)Conmand Object
(,1)Connection object

(l)Data Set

Dataset ADO.Net d Discormected Data Access Model ot vo kq<l t


qg Data Tables Collection ei'l-s Data Relation
Collection o't Contain s\-dr it s6 Data ii Collection aJ Reprosent o{fl B dd
Datasouce il Retrieve fuqr qor t
r-S Data adapter ti rrre{ use fuqr qror i r c6 w isr object i ]ffi iq
ol vo qr rirs oG !r< s+ q-{r+ iJ manipulate
fuql -II eqm i g-sd d t
lig DataSource and Cormection o't open {qi 3 qqqfl {fi qgfi Dataset ]i+r Datasouce
qrflfi
'a't A Work Perform orot qfl q6 l]1il srrfl{l Dataadapter d rm dfi
t t
Dataset...

(2)Data Adapter

Prepared By-Nltendla Tomar Page No-57


c6 ADO.Net Data Provider al qo Mdn Part i I s6 Dataset and Datasource A dJq Commrurication d lid use loql
q[fl t DataAdapter o] dataset A sr"J use fusI qot t qg <l=it Oblect 1]oor Data Access and Data marupulation
Provide oro B Data Adapter Iif{q SQL Statements di Select. Insed, updata and Delete Operation aJ Datasouce
i qmr Perform orot i r-{ri Inse , Updata and dalete Peroform ori w dataDataset t qtd{ datasoruce il Changes
oJ store elo t qqfu Select Operation oI use Dataset aJ F l o{i + ftc

(3)Command

s6 ADO.Net sr vo Inrpo ant Conrponent t t fusor use sql statementsa) execute ori d Ii{ fuql qm i q6
corurection object t defiaeftri qi iq eN t sql statements ol execute 6{ ddr o) manipulate orm t cE q}t rort d
sql statemants qil execute tnrot tt
(,1)C onnection

c6 ADO.Net slcr plovider oI impoftant paft i fusor use datasouce and Applicahon d fiq Commrmication qcri d
IiIc fuql srfl i rE Commuucation Path comection Stdng w Depend o.{ot t Comention Object Specifr ful .ru
Database t cormectlon o+or vfr Open orot t I qo qr< comection A q€ ow t Create €ti d qr< SQL Commands aJ
Execute

Exercise

Step l-F st Create the Mndow Applicatlon in Visual Studro and Design one Form Like This

Gender

Step2-Open MS Access and Create One Table with Fields Showing in Windows Form

Step3-Go to the Visual Studio and Click on Folm Write the Following Code

In!,orts Systen. DaLa. OleDb


PL'blic class AdmissionDelails
Din conn As OleDbconnection
Din da As OleDbDataAdapter
Dim Dal AB OfeDbDalaAdapler
Dim dsL AB Dataset
Din ds As Dalasel
Private sub btnsave clack{Byval sender As syslen.oblect. Byvaf e As syslen. EwenlArgs)
Handles btnsave. click
Din dr As DalaRor : ds. Tables { 0I . NevRou
dr (1) : lxlNane. Te.t
dr(2) : TxlEatherNane . TerL ( )
If rbtnuale. checked Then
Prepared By-Nltendra Tomar Page No-58
nlse
dr ljl : !a1se
Eldi ff
dr (4) : lxlDate. Text
dr (5J : cnbc ourse -.se Le ct edrt en
dr (61 .: txlcontiaQtNo. Teit
dr (?) : txlAddre5s, rext o
d-s, ralcl€s (O ) , Ravs.A.td (dr )
Dim cb AE Nev ofeDbcoDrandDualder (da)
da.Update (ds, IAd&rs5iotlDetar.ls" )
MessaqeBox. shoB.( *record Eaw€ suceusf ullyr )

P.rivate si1b AdnissionDetaits i-oad (8fia1 sender As SvsLer.Ob,lecL. B',4/al- e As


SysLem. Eve^LArgs) .{6nd. e5 MyBs5e. Loao
aonrl: I,I€s OleDtconnectionl " Plovidsr=Uic.osoft, Jet. OLEDB. { . Ot DEta
Source:Drr \\!io
\!io1scts\coachj
!io1€.ets\ coachidocla'ssesgoluiion\ Coachir1a,mdb" ))
J €.cts\coachingcla'5sesSoluiion\Coachir1qr,adb"
da : Nel. o]eDbDataSdapler (!'selai:t*froh Adr]issionlletsailsn.
ds : N€v Dataset
da.r'af I (ds, "AdeisEionDer4ilstr )
Diel = ]\Ieu ofeDbDatE-Adapter ("ielect * fxom eourBesDetails",
ds1 = Neu Dai:aseL
da. I11I (ds1. ncour.BesDetailB'r )
DataGrldviell, Datasor"rrce : d31. Tables (0)
cmcourse. Da -asor ce dsl.Tal, es(0)
clobcourse-Di5pj-ayMenber = qqourse<Ntr-'
Elld Slrb
nrld 91a95

Stct4Run tlte A@lication Enler Ddta into Firrh and Click Will Save on MS
Access Table

itepared By-Niterdra Tonw Page No-59

You might also like