以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 请教甜老大 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=62971) |
||||
-- 作者:hbhb -- 发布时间:2015/1/11 11:57:00 -- 请教甜老大 甜老师:好!如实例 请问如何实现以下功能,如果编号及职务与姓名不在同一行,则移动编号及职务到与姓名同一行,并删除此行?
|
||||
-- 作者:有点甜 -- 发布时间:2015/1/11 12:49:00 -- Dim t As Table = Tables("表A") Dim r1 As Row = t.Rows(0) Dim r2 As Row = t.Rows(1) For Each c As Col In t.Cols If r1.IsNull(c.name) Then r1(c.name) = r2(c.name) End If Next |
||||
-- 作者:hbhb -- 发布时间:2015/1/11 13:22:00 -- 谢谢!对于何时遍列行,何时遍列列的用法,一直没有掌握,能否帮助总结一下,以赐老弟。 |
||||
-- 作者:hbhb -- 发布时间:2015/1/11 13:51:00 -- 甜老大,再升华一下条件: 1、如果不知道两行分别在第几行的情况 2、如果编号或职务列与姓名同行不一定为空的情况 该如何写代码?
|
||||
-- 作者:有点甜 -- 发布时间:2015/1/11 15:34:00 -- Dim t As Table = Tables("表A") Dim sr As Row For Each r As Row In t.Rows For Each c As Col In t.Cols If r.IsNull(c.name) = False Then sr = r Exit For End If Next If sr IsNot Nothing Then Exit For Next For Each c As Col In t.Cols If sr.IsNull(c.name) Then Dim fdr As DataRow = t.DataTable.Find(c.name & " Is not null", "_Identify") If fdr IsNot Nothing Then sr(c.name) = fdr(c.name) End If End If Next |