1 VBScript Session 17. 2 What we learn last session?

Slides:



Advertisements
Similar presentations
TWO STEP EQUATIONS 1. SOLVE FOR X 2. DO THE ADDITION STEP FIRST
Advertisements

You have been given a mission and a code. Use the code to complete the mission and you will save the world from obliteration…
1 VBScript Session What we learn last session? Regulars Expressions. Methods and properties. How to use the object and his collections. How to create.
Advanced Piloting Cruise Plot.
Final and Abstract Classes
Classes and Objects in Java
Chapter 7 Constructors and Other Tools. Copyright © 2006 Pearson Addison-Wesley. All rights reserved. 7-2 Learning Objectives Constructors Definitions.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide STARTING OUT WITH Visual Basic 2008 FOURTH EDITION Tony Gaddis.
Classes, Exceptions, Collections, and Scrollable Controls
Lists, Loops, Validation, and More
Chapter 1 The Study of Body Function Image PowerPoint
Copyright © 2011, Elsevier Inc. All rights reserved. Chapter 5 Author: Julia Richards and R. Scott Hawley.
1 Copyright © 2010, Elsevier Inc. All rights Reserved Fig 2.1 Chapter 2.
By D. Fisher Geometric Transformations. Reflection, Rotation, or Translation 1.
Business Transaction Management Software for Application Coordination 1 Business Processes and Coordination.
7 Copyright © 2005, Oracle. All rights reserved. Creating Classes and Objects.
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Title Subtitle.
My Alphabet Book abcdefghijklm nopqrstuvwxyz.
0 - 0.
DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
MULTIPLYING MONOMIALS TIMES POLYNOMIALS (DISTRIBUTIVE PROPERTY)
SUBTRACTING INTEGERS 1. CHANGE THE SUBTRACTION SIGN TO ADDITION
MULT. INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
FACTORING Think Distributive property backwards Work down, Show all steps ax + ay = a(x + y)
FACTORING ax2 + bx + c Think “unfoil” Work down, Show all steps.
Addition Facts
Year 6 mental test 5 second questions
Around the World AdditionSubtraction MultiplicationDivision AdditionSubtraction MultiplicationDivision.
ZMQS ZMQS
1.
Lecture 15 Linked Lists part 2
BT Wholesale October Creating your own telephone network WHOLESALE CALLS LINE ASSOCIATED.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Exercise Session 5.
ABC Technology Project
Access Lesson 13 Programming in Access Microsoft Office 2010 Advanced Cable / Morrison 1.
1 Undirected Breadth First Search F A BCG DE H 2 F A BCG DE H Queue: A get Undiscovered Fringe Finished Active 0 distance from A visit(A)
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 12 – Security Panel Application Introducing.
1 What is JavaScript? JavaScript was designed to add interactivity to HTML pages JavaScript is a scripting language A scripting language is a lightweight.
VOORBLAD.
Squares and Square Root WALK. Solve each problem REVIEW:
© 2012 National Heart Foundation of Australia. Slide 2.
Lets play bingo!!. Calculate: MEAN Calculate: MEDIAN
1 Chapter 4 The while loop and boolean operators Samuel Marateck ©2010.
Chapter 5 Test Review Sections 5-1 through 5-4.
SIMOCODE-DP Software.
GG Consulting, LLC I-SUITE. Source: TEA SHARS Frequently asked questions 2.
What You Should Learn • Represent and classify real numbers.
1 of 31 Images from Africa. 2 of 31 My little Haitian friend Antoine (1985)
1 of 32 Images from Africa. 2 of 32 My little Haitian friend Antoine (1985)
Addition 1’s to 20.
25 seconds left…...
Januar MDMDFSSMDMDFSSS
Week 1.
We will resume in: 25 Minutes.
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
Chapter 12 OOP: Creating Object- Oriented Programs Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
1 Unit 1 Kinematics Chapter 1 Day
PSSA Preparation.
How Cells Obtain Energy from Food
1 Abstract Class and Packages from Chapter 9 Lecture.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 13 – Salary Survey Application: Introducing.
Chapter 9: Using Classes and Objects. Understanding Class Concepts Types of classes – Classes that are only application programs with a Main() method.
1 Lecture 16:User-Definded function I Introduction to Computer Science Spring 2006.
Why to Create a Procedure
VBScript Session 7 Dani Vainstein.
Presentation transcript:

1 VBScript Session 17

2 What we learn last session?

3 Subjects for session 17 Class object. Class statement. Property Let. Property Get. Property Set. Initialize event. Terminate event. Inline classes. Registering your COM classes.

4 Classes in VBScript Class Object The object created using the Class statement. Provides access to the events of the class. You cannot explicitly declare a variable to be of type Class. In the VBScript context, the term "class object" refers to any object defined using the VBScript Class statement. Dim X Set X = New classname

5 Classes in VBScript Class Statement Declares the name of a class, as well as a definition of the variables, properties, and methods that comprise the class. Syntax Class name statements End Class

6 Classes in VBScript Class Statement Within a Class block, members are declared as either Private or Public using the appropriate declaration statements. Anything declared as Private is visible only within the Class block. Anything declared as Public is visible within the Class block, as well as by code outside the Class block. Anything not explicitly declared as either Private or Public is Public by default. Procedures (either Sub or Function) declared Public within the class block become methods of the class. Public variables serve as properties of the class, as do properties explicitly declared using Property Get, Property Let, and Property Set. Default properties and methods for the class are specified in their declarations using the Default keyword.

7 Classes in VBScript Get Property Statement Declares, in a Class block, the name, arguments, and code that form the body of a Property procedure that gets (returns) the value of a property. Syntax [Public [Default] | Private] Property Get name [(arglist)] [statements] [[Set] name = expression] [Exit Property] [statements] End Property

8 Classes in VBScript Get Property Statement If not explicitly specified using either Public or Private, Property Get procedures are public by default, that is, they are visible to all other procedures in your script. The value of local variables in a Property Get procedure is not preserved between calls to the procedure. You can't define a Property Get procedure inside any other procedure. The Exit Property statement causes an immediate exit from a Property Get procedure. Property Get procedure is a separate procedure that can take arguments, perform a series of statements, and change the value of its arguments.

9 Classes in VBScript Let Property Statement Declares, in a Class block, the name, arguments, and code that form the body of a Property procedure that assigns (sets) the value of a property. Syntax [Public [Default] | Private] Property Let name ([arglist,] value) [statements] [[Set] name = expression] [Exit Property] [statements] End Property

10 Classes in VBScript Let Property Statement If not explicitly specified using either Public or Private, Property Let procedures are public by default, that is, they are visible to all other procedures in your script. The value of local variables in a Property Let procedure is not preserved between calls to the procedure. You can't define a Property Let procedure inside any other procedure. The Exit Property statement causes an immediate exit from a Property Let procedure. Every Property Let statement must define at least one argument for the procedure it defines.

11 Classes in VBScript Set Property Statement Declares, in a Class block, the name, arguments, and code that form the body of a Property procedure that sets a reference to an object. Syntax [Public [Default] | Private] Property Set name ([arglist,] reference) [statements] [[Set] name = expression] [Exit Property] [statements] End Property

12 Classes in VBScript Set Property Statement If not explicitly specified using either Public or Private, Property Set procedures are public by default, that is, they are visible to all other procedures in your script. The value of local variables in a Property Set procedure is not preserved between calls to the procedure. You can't define a Property Set procedure inside any other The Exit Property statement causes an immediate exit from a Property Set procedure. Every Property Set statement must define at least one argument for the procedure it defines.

13 Classes in VBScript Initialize Event Occurs when an instance of the associated class is created. Syntax Private Sub Class_Initialize() statements End Sub Set X = New TestClass ' Create an instance of TestClass. Set X = Nothing ' Destroy the instance.

14 Classes in VBScript Terminate Event Occurs when an instance of the associated class is terminated. Syntax Private Sub Class_Terminate() statements End Sub Set X = New TestClass ' Create an instance of TestClass. Set X = Nothing ' Destroy the instance.

15 Classes in VBScript Inline Classes Inline class is a class that you can immediatelly use without registering the class.

16 Classes in VBScript MyArray Class - Example Inline class is a class that you can immediatelly use without registering the class. VBScript\VBS\class.vbs

17 Creating a COM Class Step 1 Open a new ActiveX DLL Project in Visual Basic 6

18 Creating a COM Class Step 2 Rename the project

19 Creating a COM Class Step 3 Remove the existing empty class

20 Creating a COM Class Step 4 Open the VB Class builder

21 Creating a COM Class Step 5 Create a new class

22 Creating a COM Class Step 6 Add properties, methods, events and enums using the class builder.

23 Creating a COM Class Step 7 Update the project

24 Save the project and compile the dll.

Make sure to visit us Tutorials Articles Proikects And much more 25