Hour 7. Working with Objects in Visual Basic


In this hour, we will cover

  • The difference between objects and classes

  • Creating an object

  • Setting an object's properties

  • Calling an object's methods

  • Handling an object's events

  • Examples of creating objects from classes in the .NET Framework

In Hour 5, "Understanding Visual Basic's Variables and Operators," we looked at using variables and operators in Visual Basic. In Hour 6, "Managing Program Flow with Visual Basic's Control Structures," we looked at control structures, such as If statements, looping constructs, and subroutines and functions. There's one more important topic we need to discuss regarding Visual Basic before moving on to future topics. Specifically, we need to examine how to use objects in Visual Basic.

Recall from our discussion of object-oriented programming in Hour 2, "Understanding the ASP.NET Programming Model," that the key component of an object-oriented programming language is an object, which is an instance of a class. In this hour we'll reexamine the relationship between an object and a class and discuss the role of classes and objects in Visual Basic, the .NET Framework, and ASP.NET web pages.

Whether you realize it or not, you've already used an assortment of objects in the source code you've written in the previous chapters. Each ASP.NET Web control, for example, exists as an object in the source code portion. When setting the Text property of a Label control or handling the Click event of a Button Web control, you are working with objects. Objects are widely used in object-oriented programming languages, like Visual Basic, which is why the topic merits a thorough examination.




Sams Teach Yourself ASP. NET 2.0 in 24 Hours, Complete Starter Kit
Sams Teach Yourself ASP.NET 2.0 in 24 Hours, Complete Starter Kit
ISBN: 0672327384
EAN: 2147483647
Year: 2004
Pages: 233

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net