以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 如何对窗口里的table1进行遍历?或者只遍历最新的100行DATATALBE? (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=55053) |
-- 作者:zhchling -- 发布时间:2014/8/9 18:33:00 -- 如何对窗口里的table1进行遍历?或者只遍历最新的100行DATATALBE? For Each dr As DataRow In DataTables("mo").dataRows
next
以上代码是对DATATABLES进行遍历,
问题1:如果对窗口里的table1进行遍历,怎么改写代码? 问题2:上面的代码对DATATALBE里所有的数据行都遍历了,怎么设置遍历的行数,比如只遍历最新的100行 |
-- 作者:lsy -- 发布时间:2014/8/9 19:02:00 -- Dim drs As List(Of DataRow) = DataTables("订单").Select("","_Identify Desc") Dim i As Integer For Each dr As DataRow In drs i + = 1 Output.Show(dr("_Identify")) If i = 100 Then Exit For End If Next |
-- 作者:zhchling -- 发布时间:2014/8/9 19:11:00 -- 问题1怎么解决? 只对窗口里TABLE1里显示的数据行进行遍历 For Each dr As Row In Tables("窗口1_table1").Rows 这么写的是不对的,
怎么写代码? [此贴子已经被作者于2014-8-9 19:19:03编辑过]
|
-- 作者:lsy -- 发布时间:2014/8/10 8:20:00 -- Tables("窗口1_table1").Filter = "XXX" For Each r As Row In Tables("窗口1_table1").Rows MessageBox.Show(r("XXX")) next
怎么不对? |
-- 作者:有点甜 -- 发布时间:2014/8/10 9:06:00 -- 你的表名要写对才行
For Each r As Row In Tables("表A").Rows MessageBox.Show(r("XXX")) next |