property Bars.Item (Name as Variant) as Bar
Returns a specific Column of the Columns collection.

 TypeDescription 
   Name as Variant A string expression that indicates the name of the bar being accessed, a long expression that indicates the index of the Bar being accessed  
   Bar A Bar object being accessed.  
Use the Item property to access a Bar object in the Bars collection. The Count property counts the bars in the collection.  Use the Remove method to remove a bar from the Bars collection. Use the Clear method to clear the Bars collection. Use the Name property to retrieve the name of the bar. The Bars collection contains several predefined bars like follows:

By default, the Bars collection includes the following predefined bars:

The following VB sample enumerates the Bar objects in the Bars collection ( the order of the elements is arbitrary ):

With G2antt1.Chart
    Dim b As EXG2ANTTLibCtl.Bar
    For Each b In .Bars
        Debug.Print b.Name
    Next
End With

The following VB sample enumerates the Bar objects in the Bars collection ( the list is alphabetically sorted ):

With G2antt1.Chart.Bars
    Dim i As Long
    For i = 0 To .Count - 1
        Debug.Print .Item(i).Name
    Next
End With

The following C++ sample enumerates the Bar objects in the Bars collection:

CBars bars = m_g2antt.GetChart().GetBars();
for ( long i = 0; i < bars.GetCount(); i++ )
	OutputDebugString( bars.GetItem( COleVariant( i ) ).GetName() );

The following VB.NET sample enumerates the Bar objects in the Bars collection:

With AxG2antt1.Chart
    Dim b As EXG2ANTTLib.Bar
    For Each b In .Bars
        Debug.Write(b.Name)
    Next
End With

The following VB.NET sample enumerates the Bar objects in the Bars collection:

With AxG2antt1.Chart.Bars
    Dim i As Integer
    For i = 0 To .Count - 1
        Debug.Write(.Item(i).Name)
    Next
End With

The following C# sample enumerates the Bar objects in the Bars collection:

EXG2ANTTLib.Bars bars = axG2antt1.Chart.Bars;
for (int i = 0; i < bars.Count; i++)
	System.Diagnostics.Debug.Write(bars[i].Name);

The following VFP sample enumerates the Bar objects in the Bars collection:

local i
With thisform.G2antt1.Chart.Bars
	for i = 0 to .Count - 1
		wait window nowait .Item(i).Name
	next
EndWith
 


Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.