Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
DataGrid Object

DataGrid Object

Visual Studio .NET 2003

Represents a virtual matrix containing labels and data points for the MSChart control.




The DataGrid object is configured as rows and columns. You can add and subtract rows, columns, and labels to this matrix to change the appearance of the chart.


The following example sets the chart parameters for a three-dimensional bar chart, fills the chart with random data and labels the data grid columns.

Private Sub Command1_Click()
   Dim rowLabelCount, columnLabelCount, rowCount As Integer
   Dim columnCount, labelIndex, Column, Row 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.
      ' Then assign labels to second Level.
      labelIndex = 2
      column = 1
      .ColumnLabel(column, labelIndex) = "Product 1"
      column = 4
      .ColumnLabel(column, labelIndex) = "Product 2"
      row = 1
      .RowLabel(row, labelIndex) = "1994"
      row = 4
      .RowLabel(row, labelIndex) = "1995"
   End With
End Sub

See Also

Properties, Methods, and Events | DataGrid Property

© 2015 Microsoft