以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  用remove移除行还打5折?  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=48968)

--  作者:flashbirdy
--  发布时间:2014/4/9 21:27:00
--  用remove移除行还打5折?
用下面语句移除表A中没有选中的行, 一次只能移除所有行的一半, 运行好几次才能搞定, 不知道怎么回事大家看  

For Each r As Row In Tables("表A").Rows

    If r.Checked = False Then

        r.Remove

    End If

Next


--  作者:flashbirdy
--  发布时间:2014/4/9 21:36:00
--  
就是想只加载选中的行,有什么办法吗?
--  作者:有点甜
--  发布时间:2014/4/9 21:41:00
--  

 这样写

 

For i As Integer = Tables("表A").GetCheckedRows.count - 1 To 0 step -1
    Tables("表A").GetCheckedRows(i).remove
Next

[此贴子已经被作者于2014-4-9 21:42:28编辑过]

--  作者:flashbirdy
--  发布时间:2014/4/9 21:47:00
--  
刚好相反, 把选中的行移除了, 我是说能不能保留选中行, 是要移除非选中的行
--  作者:有点甜
--  发布时间:2014/4/9 21:51:00
--  

 呵呵,重在理解

 

For i As Integer = Tables("表A").Rows.Count - 1 To 0 Step -1
    If Tables("表A").Rows(i).Checked = False Then
         Tables("表A").Rows(i).Remove
    End If
Next


--  作者:flashbirdy
--  发布时间:2014/4/9 21:57:00
--  
图片点击可在新窗口打开查看  牛!  解决问题!  多谢多谢!