ComponentOne Chart 8.0 for ActiveX
Accessing Each of the Elements of a Collection

 

Accessing Each of the Elements of a Collection

Visual Basic enables you to access each of the elements of a collection in turn using the ForEach statement. For example, the following code positions all of the chart labels over their attachment locations:

For Each Label in Chart2D1.ChartLabels

       Label.Anchor = oc2dAnchorCenter

Next

Each collection defines a Count property whose value is the current number of objects in the collection. You can use Count to access some or all of the elements of a collection. For example, the following is another way to position all of the chart labels:

Dim Counter As Integer

For Counter = 1 To Chart2D1.ChartLabels.Count

       Chart2D1.ChartLabels(Counter).Anchor = oc2dAnchorCenter

Next

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback