Using Visual Basic.NET in Web Pages ASP.NET. Object-Oriented Programming (Page 1) Classes and Objects – Create objects based upon a class An object is.

Slides:



Advertisements
Similar presentations
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 10 Creating Classes and Objects.
Advertisements

Copyright © 2012 Pearson Education, Inc. Chapter 13: Introduction to Classes.
12-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Object-Oriented PHP (1)
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 4 Defining Your Own Classes.
Encapsulation, Inheritance & Interfaces CSE 115 Spring 2006 February 27, March 1 & 3, 2006.
Introduction to ASP.NET, Second Edition2 Chapter Objectives.
Using VB.NET with ASP.NET Page. Chapter Objectives.
C# Programming: From Problem Analysis to Program Design1 Creating Your Own Classes C# Programming: From Problem Analysis to Program Design 3rd Edition.
C#.NET C# language. C# A modern, general-purpose object-oriented language Part of the.NET family of languages ECMA standard Based on C and C++
instance variables property procedures for the mintQuantity instance variable.
Creating Object Oriented Programs Object oriented (OO) terminology Class vs. object Instantiate an object in a project Understand Class_Initialize / Terminate.
VB Classes ISYS 573. Object-Oriented Concepts Abstraction: –To create a model of an object, for the purpose of determining the characteristics (properties)
ASP.NET Programming with C# and SQL Server First Edition
VB Classes ISYS 512. Adding a Class to a Project Project/Add Class –*** MyClass is a VB keyword. Steps: –Adding properties Declare Public variables in.
Object Based Programming. Summary Slide  Instantiating An Object  Encapsulation  Inheritance  Polymorphism –Overriding Methods –Overloading vs. Overriding.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
Module 7: Object-Oriented Programming in Visual Basic .NET
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
Copyright © 2001 by Wiley. All rights reserved. Chapter 12: Programmer- Defined Types, Direct Access Files, and Object Classes Programmer Defined Data.
Why to Create a Procedure
Chapter 10: Writing Class Definitions Visual Basic.NET Programming: From Problem Analysis to Program Design.
COP INTERMEDIATE JAVA Designing Classes. Class Template or blueprint for creating objects. Their definition includes the list of properties (fields)
Chapter 51 Using Visual Basic.NET within an ASP.NET Page Introduction to ASP.NET By Kathleen Kalata.
Classes and Objects noun A word used to denote or name a person, place, thing, quality, or act. verb That part of speech that expresses existence,
Chapter 7 Objects and Classes 1 Fall 2012 CS2302: Programming Principles.
OOP IN PHP `Object Oriented Programming in any language is the use of objects to represent functional parts of an application and real life entities. For.
1 Classes and Controls CE-105 Spring 2007 By: Engr. Faisal ur Rehman.
C#/Java Classes ISYS 350. Introduction to Classes A class is the blueprint for an object. – It describes a particular type of object. – It specifies the.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Procedural and Object-Oriented Programming 13.1.
Creating Classes and Objects Chapter Microsoft Visual Basic.NET: Reloaded 1.
Advanced Object- Oriented Programming Programming Right from the Start with Visual Basic.NET 1/e 14.
Working With Objects Tonga Institute of Higher Education.
CIS 338: Classes and Modules Dr. Ralph D. Westfall May, 2011.
Chapter Eleven Classes and Objects Programming with Microsoft Visual Basic th Edition.
An Object-Oriented Approach to Programming Logic and Design Chapter 3 Using Methods and Parameters.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
CSCI 3327 Visual Basic Chapter 9: Object-Oriented Programming: Classes and Objects UTPA – Fall 2011.
CSE 341, S. Tanimoto Java brief review - 1 Java Brief Review Java’s strengths Object-oriented terminology Inheritance Interfaces An example with inheritance.
Microsoft Visual Basic 2008 CHAPTER ELEVEN Multiple Classes and Inheritance.
Programming with Microsoft Visual Basic 2012 Chapter 11: Classes and Objects.
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 5 Creating Classes.
VB Classes ISYS 512/812. Object-Oriented Concepts Abstraction: –To create a model of an object, for the purpose of determining the characteristics (properties)
© 2007 Lawrenceville Press Slide 1 Chapter 8 Objects  A variable of a data type that is a class. Also called an instance of a class.  Stores data  Can.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 9 Java Fundamentals Objects/ClassesMethods Mon.
Introduction to Object-Oriented Programming Lesson 2.
CSCI 3328 Object Oriented Programming in C# Chapter 9: Classes and Objects: A Deeper Look – Exercises 1 Xiang Lian The University of Texas Rio Grande Valley.
C# Classes ISYS 350. Introduction to Classes A class is the blueprint for an object. – It describes a particular type of object. – It specifies the properties.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 27 I Love this Class.
Object-Oriented Programming (OOP) What we did was: (Procedural Programming) a logical procedure that takes input data, processes it, and produces output.
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
Inheritance and Class Hierarchies Chapter 3. Chapter Objectives  To understand inheritance and how it facilitates code reuse  To understand how Java.
5.1 Basics of defining and using classes A review of class and object definitions A class is a template or blueprint for an object A class defines.
Object-Oriented Programming: Classes and Objects Chapter 1 1.
C# Programming: From Problem Analysis to Program Design1 Creating Your Own Classes C# Programming: From Problem Analysis to Program Design 4th Edition.
Object-Oriented Programming: Classes and Objects.
Java Programming: Guided Learning with Early Objects Chapter 9 Inheritance and Polymorphism.
Computer Programming II Lecture 5. Introduction to Object Oriented Programming (OOP) - There are two common programming methods : procedural programming.
Object-oriented programming (OOP) is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their.
ActionScript Programming Help
CE-105 Spring 2007 By: Engr. Faisal ur Rehman
Inheritance Modern object-oriented (OO) programming languages provide 3 capabilities: encapsulation inheritance polymorphism which can improve the design,
Programming the Web Using Visual Studio .NET
Microsoft Visual Basic 2005: Reloaded Second Edition
Table of Contents Class Objects.
Creating Your OwnClasses
Chapter 11 – Object-Oriented Programming
Programming with Microsoft Visual Basic 2008 Fourth Edition
CSCI 3328 Object Oriented Programming in C# Chapter 9: Classes and Objects: A Deeper Look – Exercises UTPA – Fall 2012 This set of slides is revised from.
CIS16 Application Development and Programming using Visual Basic.net
Presentation transcript:

Using Visual Basic.NET in Web Pages ASP.NET

Object-Oriented Programming (Page 1) Classes and Objects – Create objects based upon a class An object is a set of related code that is compartmentalized and built upon these classes Access the object across multiple Web pages – Create an object The object definition, called the class Creating an instance of the class – Use the class as the template ("blueprint") for creating the new object Open ClassVariables.aspx

Object-Oriented Programming (Page 2) Multiple objects can be created (instantiated) from the same class definition Example of a class definition: Public Class TaraStoreClass Private StoreName As String = "Tara Store" End Class

Object-Oriented Programming (Page 3) Restrict applications access to the class – Public—interact with other objects outside of the base class – Private—called only from within the base class – Protected—called from within the base class, and within subclasses Subclass—a class that inherits from a base class – Friend—called anywhere from within the same application

Object-Oriented Programming (Page 4) Instantiate an object based on the class definition – Declare a variable The keyword Dim to store the object The keyword New to identify that this is an object based on a class definition – Example: Dim objCh5 As New TaraStoreClass()

Object-Oriented Programming (Page 5) Properties – Sets (updates) or gets (retrieves) the value of a variable defined within an object – Identified by the object name, a dot (.), and the property name, i.e. objCh5.StoreName – May be assigned a default value within the class definition, or the value is set as "undefined" – All new objects inherit the same properties as the original object definition

Object-Oriented Programming (Page 6) Inheritance – Derives the interface and behaviors from another class – The Inherits keyword allows one class to inherit features from another.NET class – All objects in every VB.NET application are inherited from the System.Object class – Methods from System.Object such as ToString () apply to most objects Encapsulation – Inner workings of object are maintained within object

ClassVariables.aspx

Programmer-Defined Properties (Page 1) Object variables store the programmer-defined property values In Visual Basic programming, they are managed within special Property procedures – Used to keep object variables Private Property procedures are VB.NET's tools for providing update and retrieve capabilities (indirectly) for Private variables using Public methods … – One of the values of such methods it that they can provide validating techniques within the statements Open SampleUsingVB.aspx

Programmer-Defined Properties (Page 2) Each of Property procedures may have two methods: – Set methods update the value of an instance variable – Get methods retrieve an instance variable value A Property procedure that only may "set" a value must have the declaration WriteOnly, i.e. Public WriteOnly Property NewStore () As String A Property procedure that only may "get" a value must have the declaration ReadOnly, i.e. Public ReadOnly Property NewStoreName() As String

Programmer-Defined Properties (Page 3) Format: Public Property propertyName() As dataType Get statements End Get Set(ByVal varName As dataType) statements End Set End Property Must match

Programmer-Defined Properties (Page 4) Example: Public Property NewStoreName() As String Get Return strStoreName End Get Set(ByVal Value As String) strStoreName = Value End Set End Property

The Set Method (Page 1) Updates the value of an instance variable Its always assigns either: – The Value which it gets from the variable in the parameter list in procedure heading – A default value May only exist in a Property procedure Set method for a object is called when a value is assigned to the property of that object, i.e. objTS2.NewStoreName = "Tara Store Chicago"

The Set Method (Page 2) Format: Set(ByVal varName As dataType) [statements_including] instanceVariable = varName/defaultValue End Set Example: Set(ByVal Value As String) strStoreName = Value End Set

The Get Method (Page 1) Retrieves the value of an instance variable Its always uses keyword Return along with the name of the instance variable (usually a single statement) Also may only exist in a Property procedure Get method for a object is called when the object's property is assigned to another variable, i.e. lblTitle.Text = objTS2.NewStoreName

The Get Method (Page 2) Format: Get [statements_including] ' not likely Return instanceVariable End Get Example: Get Return strStoreImage End Get

SampleUsingVB.aspx