What is VB Script Programming

May 18, 2018 | Author: apex_tgi | Category: Scripting Language, Software Engineering, Software, Computer Programming, Computing
Share Embed Donate


Short Description

VBScript (Visual Basic Scripting Edition) is an Active Scripting language developed by Microsoft that is modeled on Visu...

Description

What is Vb Script Script Programing

By Apex TG India Pvt Ltd

 

Class object. Class statement. Property Let.  Property Get.  Property Set.  Initialize event.  Terminate  Terminate event. 

 

Inline classes. Registering your C! classes.

Classes in VBScript Class b!ect   



 T#e object create$ create$ using t#e Class statement. Provi$es access to t#e events o% t#e class.  &ou  &ou cannot e'plicitly e'plicitly $eclare $eclare a variable to be o% type Class. In t#e ()Script conte't* t#e term +class object+ re%ers to any object $e,ne$ using t#e ()Script Class statement. Dim Set -  New classname 

Classes in VBScript Class Statement 0eclares t#e name o% a class* as ell as a $e,nition o% t#e variables* properties* properties* an$ met#o$s m et#o$s t#at comprise t#e class.  Synta' 

Class name  statements  End Class

Classes in VBScript Class Statement 

 









3it#in a Class bloc4* members are $eclare$ as eit#er Private or appropriate $eclaration statements. Public using t#e appropriate 5nyt#ing $eclare$ as Private is visible only it#in t#e Class bloc4. 5nyt#ing $eclare$ as Public is visible it#in t#e Class bloc4* as ell as by co$e outsi$e t#e Class bloc4. 5nyt#ing not e'plicitly $eclare$ as eit#er Private or Public is Public by $e%ault. Proce$ures 6eit#er Sub or Function7 $eclare$ Public it#in t#e class bloc4 become met#o$s o% t#e class. Public variables serve as properties o% t#e class* as $o properties e'plicitly $eclare$ using Property Get* Property Let* an$ Property Set. 0e%ault properties an$ met#o$s %or t#e class are speci,e$ in t#eir $eclarations using t#e Default 4eyor$.

Classes in VBScript Get Property Statement 



0eclares* in a Class bloc4* t#e name* arguments* an$ co$e t#at %orm t#e bo$y o% a Property proce$ure t#at gets 6returns7 t#e value o% a property. Synta' 9Public 9Default: ; Private: Property Get name  [(arglist : 9statements : 99Set: name     e'pression : 9E!it Property: 9statements : End Property

Classes in VBScript Get Property Statement 









I% not e'plicitly e'plicitly speci,e$ using eit#er Public or Private* Property Get proce$ures are public by $e%ault* t#at is* t#ey are visible to all ot#er proce$ures in your script.  T#e value o% local local variables in in a Property Get proce$ure is not preserve$ beteen calls to t#e proce$ure.  &ou  &ou can=t $e,ne a Property Get proce$ure insi$e any ot#er proce$ure.  T#e E!it Property statement causes an imme$iate e'it %rom a Property Get proce$ure. Property Get proce$ure is a separate proce$ure t#at can ta4e arguments* per%orm a series o% statements* an$ c#ange t#e value o% its arguments.

Classes in VBScript Let Property Statement 



0eclares* in a Class bloc4* t#e name* arguments* an$ co$e t#at %orm t#e bo$y o% a Property proce$ure t#at assigns 6sets7 t#e value val ue o% a property. property. Synta' 9Public 9Default: ; Private: Property Let name  (9arglist *: *: value  9statements : 99Set: name     e'pression : 9E!it Property : 9statements : End Property

Classes in VBScript Let Property Statement 









I% not e'plicitly speci,e$ using eit#er Public or Private* Property Let proce$ures are public by $e%ault* t#at is* t#ey are visible to all ot#er proce$ures in your script.  T#e value o% local variables in a Property Let proce$ure is not preserve$ beteen calls to t#e proce$ure.  &ou  &ou can=t $e,ne $e,ne a Property Let proce$ure insi$e any ot#er proce$ure.  T#e E!it Property statement causes an imme$iate e'it %rom a Property Let proce$ure. @very Property Let statement must $e,ne at least one argument %or t#e proce$ure it $e,nes.

Classes in VBScript Set Property Statement 



0eclares* in a Class bloc4* t#e name* arguments* an$ co$e t#at %orm t#e bo$y o% a Property proce$ure t#at sets a re%erence to an object. Synta' 9Public 9Default: ; Private: Property Set name  (9arglist *: *: re%erence  9statements : 99Set: name     e'pression : 9E!it Property : 9statements : End Property

Classes in VBScript Set Property Statement 









I% not e'plicitly speci,e$ using eit#er Public or Private* Property Set proce$ures are public by $e%ault* t#at is* t#ey are visible to all ot#er proce$ures in your script.  T#e value o% local variables in a Property Set proce$ure is not preserve$ beteen calls to t#e proce$ure.  &ou  &ou can=t $e,ne $e,ne a Property Set proce$ure insi$e any ot#er  T#e E!it Property statement causes an imme$iate e'it %rom a Property Set proce$ure. @very Property Set statement must $e,ne at least one argument %or t#e proce$ure it $e,nes.

Classes in VBScript Initiali"e #vent 



ccurs #en an instance o% t#e t #e associate$ class is create$. Synta' Private Sub ClassBInitialize67 ClassBInitialize67 statements  End Sub Set -  New TestClass Set -  Not"in#

= Create an instance o% TestClass. TestClass. = 0estroy t#e instance.

Classes in VBScript Terminate #vent 



ccurs #en an instance o% t#e t #e associate$ class is terminate$. Synta' Private Sub ClassBTerminate67 statements  End Sub Set -  New TestClass Set -  Not"in#

= Create an instance o% TestClass. TestClass. = 0estroy t#e instance.

Classes in VBScript Inline Classes 

Inline class is a class t#at you can imme$iatelly use it#out registering t#e class.

Classes in VBScript $yArray Class % #xample Inline class is a class t#at you can imme$iatelly use it#out registering t#e class. ()Script()Sclass.vbs



Creating a C$ Class Step & 

pen a ne 5ctive- 0LL Project in (isual )asic 8

Creating a C$ Class Step ' 

Rename t#e project

Creating a C$ Class Step ( 

Remove t#e e'isting empty class

Creating a C$ Class Step ) 

pen t#e () Class buil$er

Creating a C$ Class Step * 

Create a ne class

Creating a C$ Class Step + 

5$$ properties* met#o$s* events an$ enums using t#e class cl ass buil$er. buil$er.

Creating a C$ Class Step , 

Dp$ate t#e project



Save t#e project an$ compile t#e $ll.

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF