标题:无法更改数组的维数
只看楼主
vbcaonia
Rank: 1
等 级:新手上路
帖 子:97
专家分:0
注 册:2016-5-4
结帖率:100%
已结贴  问题点数:20 回复次数:2 
无法更改数组的维数


下面这段程序中的:ReDim sj(1, add - 1)与ReDim Preserve sj(1, UBound(sj, 2) + add)都显示:无法更改数组的维数,应怎样修改,谢谢!



Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click


        Dim sj() As Long
        Dim dn As Long
        Dim sjStr() As String
        Dim str
        Dim add As Integer
        
        add = 300
        dn = 0
        ReDim sjStr(add - 1)
        ReDim sj(1, add - 1)

        For b = 1 To Rows-1
            With Me.AxfpSpread1
                .Row = b
                .Col = 1
                'Value数值,Text文本
                str = .Value
            End With

            If str <> "" Then
                If dn > UBound(sjStr) Then
                    ReDim Preserve sjStr(UBound(sjStr) + add)
                    ReDim Preserve sj(1, UBound(sj, 2) + add)
                End If
                sjStr(dn) = str
            End If
        Next b

        
    End Sub





[此贴子已经被作者于2023-4-5 18:25编辑过]

搜索更多相关主题的帖子: End str add 更改 Dim 
2023-04-05 13:00
jian4892
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:3
帖 子:11
专家分:20
注 册:2009-11-10
得分:20 
Dim sj(,) As Long
收到的鲜花
  • vbcaonia2023-04-05 22:48 送鲜花  3朵  
2023-04-05 22:11
vbcaonia
Rank: 1
等 级:新手上路
帖 子:97
专家分:0
注 册:2016-5-4
得分:0 
回复 2楼 jian4892
帮我解决了一个大问题,谢谢!
2023-04-05 22:47



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-511801-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.050446 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved