Foxtable(狐表)用户栏目专家坐堂 → [求助]如何实现部分字段的上下行移动?


  共有2191人关注过本帖树形打印复制链接

主题:[求助]如何实现部分字段的上下行移动?

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/5/24 10:40:00 [显示全部帖子]

参考代码,比如调换下一行的代码。

 

Dim cs() As String = {"第二列", "第三列"}

Dim cr As Row = Tables("表A").Current
If cr IsNot Nothing AndAlso cr.Index < Tables("表A").Rows.Count - 1 Then
    Dim nr As Row = Tables("表A").Rows(cr.Index + 1)
    For Each c As String In cs
        Dim temp As String = nr(c)
        nr(c) = cr(c)
        cr(c) = temp
    Next
End If


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/5/24 11:09:00 [显示全部帖子]

Dim cs() As String = {"第二列", "第三列"}
Dim t As Table = Tables("表A")
If t.BottomPosition < t.Rows.Count - 1 Then
    For i As Integer = t.BottomPosition To t.TopPosition Step -1
        Dim cr As Row = t.Rows(i)
        Dim nr As Row = t.Rows(i + 1)
        For Each c As String In cs
            Dim temp As String = nr(c)
            nr(c) = cr(c)
            cr(c) = temp
        Next
    Next
End If

 回到顶部