Professional Documents
Culture Documents
T T T T T I I T: RRSQN TRRFLT
T T T T T I I T: RRSQN TRRFLT
Unit-2
Q7-VB.Net t Aray q{ i
li,oi rois d t}i i
z qs t
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
"qr
Q6-vb.net t Inheritance ol s+ sEo sqsrgi r
QI0-OLE o1 ffiflsi 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
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
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
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
+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
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
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
,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
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
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
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
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
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
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
IInit-2
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
Q2- vB.Net t Yariable t qrc @r €{sd I variable 6l Declare d-t fuqr qrdr t I
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
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
My car My car
Year lYear
He & His Father (*&is rot acceptable)
Lons Name Car be USE
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
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
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
iRq{d 6r Er$rdEq
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
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
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
ListBo><1.Itens.Add a(1
ListBoxl.Itens.Add a(5
T i slBoxl - Tlems - A.l.l a (4
End sub
ListBoxl.Items.Add a
Dynamic Array
ReDim Dytura{Io)
ev
Q&VB.Ncl t Cotrtml Array t <ilc flr €cgt * 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
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
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
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
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
Endf,'unction
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
Statements
End Function
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
Syntax
If Condition then
Statement IhEck
End IF
Example
Else
Statement
(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
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 " )
l.For. . ..Next qr
2 While. .. .Endwhile 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)
Whib Loop
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
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 ()
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')
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
MessageBoxButtons.YesNocancef , MessageBoxfcon-Information)
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
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
-.:',:
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
(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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Labell - Text
If TextBox TextBox2 - Text
Then
Private S
Buttonl . Checked Then
farm : True
i oButton2 Ch ecked Ch an
RadioButton2 . Checked Then
blnAlarn : Fafse
If
width
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
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
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
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
Events DescriDtion
AfterCheck s6 Event (q Trigger tlot i, qc q{ Node Checkbox o)
Check fuq qror i r
Exercise
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
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
Showltem toolTipe
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
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)
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
! 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
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
! 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
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
Unit-4
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
-
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
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
End sub
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
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
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 ()
End Cfas s
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
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
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
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
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
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
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
Q2- Server Erlrlorer d em Data fos ron Access fft-qr qtdr tl €qgrii I
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
"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
qa w rq Mlcrosoft Access Database o't Data Soruce d sc i areate llEE 5QL 5Erud D.t6h.iE
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
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
1 Open a Connection-
2-Applyi0g a Statement.
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
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
Olodb Command
Sql Command
Oracle Command
ODBC Connnand
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
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
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
(l)Data Set
(2)Data Adapter
(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
Stct4Run tlte A@lication Enler Ddta into Firrh and Click Will Save on MS
Access Table