Foxtable(狐表)用户栏目专家坐堂 → [求助]上移行与下移行


  共有2951人关注过本帖平板打印复制链接

主题:[求助]上移行与下移行

帅哥哟,离线,有人找我吗?
2425004926
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:三尾狐 帖子:712 积分:5553 威望:0 精华:0 注册:2019/11/14 9:36:00
[求助]上移行与下移行  发帖心情 Post By:2021/2/4 15:27:00 [只看该作者]

上移行和下移行,一次移很多行,为什么速度那么慢,要等好长时间,而直接用系统里的表上移和下移速度却非常快?

 With Tables(e.form.name  & "_Table1")
    Select Case e.Sender.Name
        Case "ButtonMoveUp"       '上移行
            .StopRedraw
            Dim i As Integer
            Dim i1 As Integer = .TopRow                                    '最上行位置
            Dim i2 As Integer = .BottomRow                                 '最末行位置
            If i1 >= 1 Then                                                '如不判断,最上一行会往下跑
                For i = i1 To i2
                    .Rows(i).Move(i-1)
                Next
                .Select(i1-1,.Cols(.colsel).index,i2-1,.Cols(.colsel).index)
            Else
                .Select(i1,.Cols(.colsel).index,i2,.Cols(.colsel).index)
            End If
            .ResumeRedraw
            .Focus
            .Save()
        Case "ButtonMoveDown"     '下移行
            .StopRedraw
            Dim i As Integer
            Dim i1 As Integer = .TopRow                                    '最上行位置
            Dim i2 As Integer = .BottomRow                                 '最末行位置
            If i2 <= .Rows.Count -2 Then
                For i = i2 To i1 Step -1
                    .Rows(i).Move(i+1)
                Next
                .Select(i1+1,.Cols(.colsel).index,i2+1,.Cols(.colsel).index)
            Else
                .Select(i1,.Cols(.colsel).index,i2,.Cols(.colsel).index)
            End If
            .ResumeRedraw
            .Focus
            .Save()

 回到顶部