VB6 XArrayDB | Xarray ReDim 用法
用法解釋
官方解釋:http://helpcentral.componentone.com/nethelp/truedblist8/default.htm#!redimmethodxarraydb.htm
XArrayDB Reference / XArrayDB Object Methods
ReDim Method (XArrayDB)
This method is used to set or reset the dimensions of an XArrayDB object while preserving any existing data.
Syntax
XArrayDB.ReDimrowLB, rowUB, columnLB, columnUB(解釋)
Arguments
rowLB and rowUB are long integers specifying the lower and upper bounds for row indexes.
columnLB and columnUB are long integers specifying the lower and upper bounds for column indexes.
Return Value
None
Remarks
Method applies to XArrayDB object.
Since a newly created XArrayDB object does not have any default dimensions, you must use the ReDim method before you can assign or access array elements.
Example
The following example creates and initializes a two-dimensional XArrayDB object. The first dimension has 100 elements, with indexes starting at 1 and ending at 100. The second dimension has 6 elements, with indexes starting at 0 and ending at 5.
Dim MyArray As New XArrayDB
MyArray.ReDim 1, 100, 0, 5
例子綁定用 XArray綁定 TDBGrid
Dim X As New XArray
Private Sub Form_Load()
Dim r As Integer
Dim c As Integer
Dim clmn As TrueDBGrid80.Column‘列
r = 9 'row
c = 5 'column
X.ReDim 0, r, 0, c
TDBGrid1.Columns.Clear
For k = 0 To c
Set clmn = TDBGrid1.Columns.Add(k)'動態添加列
clmn.Visible = True
clmn.Caption = "column " & k
Next k
Call FillXArray(r, c)‘填充數據
Set Me.TDBGrid1.Array = X
Me.TDBGrid1.ReBind
End Sub
Private Sub FillXArray(intI As Integer, intJ As Integer)’填充數據
On Error Resume Next
Dim I As Integer
Dim j As Integer
Dim k As Integer
If (Err.Number <> 0) Then
MsgBox Err.Description
End If
End Sub
轉載于:https://www.cnblogs.com/wgscd/p/5212313.html
總結
以上是生活随笔為你收集整理的VB6 XArrayDB | Xarray ReDim 用法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ThinkPHP分页实例
- 下一篇: Spring中自己主动装配