我想实现的功能是,将数据表中的数据读取到一个二维数组中,然后用第三方控件画出曲线画曲线控件相关的方法描述为:PlotGraphs Method
Syntax
Function object.PlotGraph(Data As Variant, PlotNum As Integer) As Integer
Arguments
Data As Variant
A graph data or an array of graph data, data type can be byte, integer, long, float, or double
PlotNum As Integer
Number of plot that indicates how many plots be included in the array of graph data
Return Value
111
Zero if the function is successful; otherwise negative number.
-1, the data type of Data is invalid
-2, the PlotNum is invalid, it must be equal or smaller than property PlotNum
-3, the dimension of array is invalid, it must be 1 dimension, or element number of Data array is invalid, it must
be the multiple number of PlotNum.
Res
For example,
Data = [a1, b1, c1; a2, b2, c2; a3, b3, c3… … a100, b100, c100],
PlotNum = 3
a# series represents 1st plot graph data.
b# series represents 2nd plot graph data.
c# series represents 3rd plot graph data.
我的代码如下:Dim HistChatMore() As Single    '多曲线数据Private Sub Command1_Click()
Dim rs1 As ADODB.Recordset
Dim mysql As String
    Call Conn2DB    '连接数据库公共函数
    For i = 0 To 5
        mysql = "select [数据] from [数据表] where [数据种类] = '" & CStr(i) & "'"
        Set rs1 = ExcSQL(mysql)    'SQL语句执行函数,返回值是一个ADODB.Recordset
        b = rs1.RecordCount
        ReDim Preserve HistChatMore(0 To b)
          rs1.MoveFirst
          For j = 0 To b - 1
            If Not rs1.EOF And Not rs1.BOF Then
                HistChatMore(i, j) = rs1.Fields(0).value           '记录集合存入数组
                rs1.MoveNext
            End If
          Next
    Next
       
     DGraph1.PlotGraphs HistChatMore, 6
End Sub为什么每次执行到这句的时候老提示:下标越界? 有时候不提示,但是调试成a=DGraph1.PlotGraphs( HistChatMore, 6)
查看a的值是-3,看上面控件的描述,还是越界问题^^^^^^^
本人刚开始接触程序编写,头好大啊,不懂有什么更好的方法能实现?这个控件画多条曲线需要二维数组.请高手们来帮帮忙吧,万分感谢~~