DOC: DataGrid Object Code Example Does Not Work
ID: Q201958
|
The information in this article applies to:
-
Microsoft Visual Basic Professional and Enterprise Editions for Windows, version 5.0
SUMMARY
The DataGrid Object code example contains several errors that prevent the sample from working correctly. This article contains the correct code example for the DataGrid Object.
MORE INFORMATION
The DataGrid Object is part of the Microsoft Chart Control, MSChart.ocx. You can search Online Help for "DataGrid Object" and click on the Example hypertext to see the faulty code sample that should demonstrate creating a three-dimensional bar chart.
The following is the correct DataGrid Object code example:
Private Sub Command1_Click()
Dim rowLabelCount As Integer
Dim columnLabelCount As Integer
Dim rowCount As Integer
Dim columnCount As Integer
Dim labelIndex As Integer
MSChart1.chartType = VtChChartType3dBar
With MSChart1.DataGrid
' Set Chart parameters using methods.
rowLabelCount = 2
columnLabelCount = 2
rowCount = 6
columnCount = 6
.SetSize rowLabelCount, columnLabelCount, _
rowCount, columnCount
' Randomly fill in the data.
.RandomDataFill
' Then assign labels to second Level.
labelIndex = 2
columnCount = 1
.ColumnLabel(columnCount, labelIndex) = "Product 1"
columnCount = 4
.ColumnLabel(columnCount, labelIndex) = "Product 2"
rowCount = 1
.RowLabel(rowCount, labelIndex) = "1994"
rowCount = 4
.RowLabel(rowCount, labelIndex) = "1995"
End With
End Sub
Additional query words:
Keywords : kbdocerr kbCtrl kbVBp500 kbGrpVB
Version : WINDOWS:5.0
Platform : WINDOWS
Issue type :