Chapter 12: Working with Collections and the System.Collections Namespace


Chapter 12

Working with Collections and the System.Collections Namespace

After completing this chapter, you will be able to:

  • Manipulate the Controls collection on a form.

  • Use a For Each…Next loop to cycle through objects in a collection.

  • Create your own collections for managing Web site URLs and other information.

  • Use Microsoft Visual Basic for Applications collections within Microsoft Office.

In this chapter, you'll learn how to use groups of objects called collections in a Visual Basic program. You'll learn how to manage information with collections, process collection objects by using For Each…Next loops, and explore new objects within the System.Collections name-space. When you combine collection-processing skills with what you learned about arrays in Chapter 11, “Using Arrays to Manage Numeric and String Data,” you'll have much of what you need to know about managing data effectively in a program, and you'll have taken your first steps in manipulating the object collections exposed by Microsoft Visual Studio 2005 and popular Microsoft Windows applications.

Upgrade Notes: Migrating Visual Basic 6 Code to Visual Basic 2005

If you're experienced with Microsoft Visual Basic 6, you'll notice some new features in Microsoft Visual Basic 2005, including the following:

  • Visual Basic no longer has a single Collection data type. Instead, the functionality for collections is provided through the System.Collections namespace of the Microsoft .NET Framework class library. Using System.Collections, you can access several useful collection types, such as Stack, Queue, Dictionary, and Hashtable.

  • Visual Basic no longer supports control arrays (collections of controls that share the same name and are processed as a group), and you cannot group controls by using the Clipboard as you can in Visual Basic 6. However, you can continue to store controls in an array if the array is declared in the object type.



Microsoft Visual Basic 2005 Step by Step
Microsoft Visual Basic 2005 Step by Step (Step by Step (Microsoft))
ISBN: B003E7EV06
EAN: N/A
Year: 2003
Pages: 168

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