|
楼主 |
发表于 2024-10-27 12:52
|
显示全部楼层
列号:2, 标签:类型ID, 源:Type
列号:3, 标签:层级, 源:KM_ID
列号:4, 标签:上级科目, 源:TOP_KM
列号:5, 标签:科目编码, 源:KM_NO
列号:1, 标签:科目名称, 源:KM_NAME
列号:6, 标签:余额方向, 源:JD
列号:7, 标签:备注, 源:BZ
'为何 ArrayList.Add (stritm,strName,strSource) 不能二维数组吗
Private Sub Command7_Click()
Dim frm As Form
Dim ctl As Control
Dim i As Long, j As Long
Dim brr
Dim arrlist As Object
Set arrlist = CreateObject("System.Collections.ArrayList")
' 设置为当前活动窗体,或者指定窗体名称
Set frm = Me.sfrList.Form
' 遍历窗体上的所有控件
For Each ctl In frm.Controls
If TypeName(ctl) <> "Label" Then
' 控件列号,标签,行来源
i = i + 1
stritm = CStr(ctl.ColumnOrder)
strName = ctl.Controls(0).Caption
strSource = ctl.ControlSource
'为何 ArrayList.Add (stritm,strName,strSource) 不能二维数组吗
'拼接成一维数组
arrlist.Add stritm & "," & strName & "," & strSource
End If
arrlist.Sort
Next ctl
ReDim brr(1 To i)
For j = 0 To arrlist.Count - 1
Debug.Print arrlist(j)
'拆分一维数组
brr(j + 1) = Split(arrlist(j), ",")(1)
SQL = SQL & "," & Split(arrlist(j), ",")(2)
Next
MsgBox "CG"
End Sub
|
|