以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 判断当前表的某一行是否空值 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=72832) |
-- 作者:阿福 -- 发布时间:2015/8/7 9:41:00 -- 判断当前表的某一行是否空值 如果判断当前表的某一行的所有列都是空值 For i As Integer = 0 To CurrentTable.Rows.Count - 1 For Each a As Row In CurrentTable.Rows For Each b As Col In CurrentTable.Cols If CurrentTable.Cols.Contains("锁定") = True If a(i).IsNull(b.Name) = false Then a(i)("锁定") = True end if end if next next next 请问上面代码哪里出错了? 或者有其他更便捷的方法? |
-- 作者:大红袍 -- 发布时间:2015/8/7 9:53:00 -- If CurrentTable.Cols.Contains("锁定") = True For Each a As Row In CurrentTable.Rows Dim flag As Boolean = True For Each b As Col In CurrentTable.Cols If a.IsNull(b.Name) Then flag = False Exit For End If Next a("锁定") = flag Next End If |
-- 作者:阿福 -- 发布时间:2015/8/7 11:15:00 -- 我试了一下,还是不行,原来发现如果“锁定”行是逻辑列,那么逻辑列无论是false还是true,都不会是空值 所以我改了代码,这样就没问题了 If CurrentTable.Cols.Contains("锁定") = True Then For Each a As Row In CurrentTable.Rows If a("锁定") = False Then For Each b As Col In CurrentTable.Cols If b.Name <> "锁定" If a.IsNull(b.Name) = False a("锁定") = True End If End If Next End If Next End If
|