以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 帮忙改下用select case (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=157592) |
-- 作者:wakai -- 发布时间:2020/10/21 22:27:00 -- 帮忙改下用select case 列太多了,用if写太长,请大神帮忙改下select case,写在CurrentChanged事件 If Tables("A").Current("第一列")= "/" Then \'Tables("B").Current("第一列")= "/" else Return End If If Tables("A").Current("第二列")= "/" Then \'Tables("B").Current("第二列")= "/" else Return End If |
-- 作者:有点蓝 -- 发布时间:2020/10/22 8:49:00 -- 这个逻辑不关select case的事 dim r as row = e.table.current dim r2 as row = Tables("B").current if r is nothing orelse r2 is nothing then return dim cls() as string = {"第一列","第二列"} for each c as string in cls if r(c) = "/" then r2(c) = "/" end if next |
-- 作者:wakai -- 发布时间:2020/10/22 22:03:00 -- 以下是引用有点蓝在2020/10/22 8:49:00的发言:
蓝老师,如果列名不相同要怎么写
这个逻辑不关select case的事 dim r as row = e.table.current dim r2 as row = Tables("B").current if r is nothing orelse r2 is nothing then return dim cls() as string = {"第一列","第二列"} for each c as string in cls if r(c) = "/" then r2(c) = "/" end if next |
-- 作者:有点蓝 -- 发布时间:2020/10/22 22:06:00 -- 参考:http://www.foxtable.com/webhelp/topics/1533.htm,看第二段代码 |
-- 作者:2900819580 -- 发布时间:2020/10/23 8:08:00 -- Dim r As Row = e.Table.current
Dim r2 As Row = Tables("B").current If r Is Nothing OrElse r2 Is Nothing Then Return \'dim cls() as string = {"第一列","第二列"} For Each c As Col In e.Table.cols If r(c.name) = "/" AndAlso Tables("B").cols.Contains(c.Name) Then r2(c.name) = "/" End If Next |
-- 作者:有点蓝 -- 发布时间:2020/10/23 8:23:00 -- 以下是引用2900819580在2020/10/23 8:08:00的发言:
这种仅适合列名一样的情况
Dim r As Row = e.Table.current
Dim r2 As Row = Tables("B").current If r Is Nothing OrElse r2 Is Nothing Then Return \'dim cls() as string = {"第一列","第二列"} For Each c As Col In e.Table.cols If r(c.name) = "/" AndAlso Tables("B").cols.Contains(c.Name) Then r2(c.name) = "/" End If Next |
-- 作者:wakai -- 发布时间:2020/10/23 23:27:00 -- 以下是引用有点蓝在2020/10/22 22:06:00的发言:
蓝老师 ,不知道怎么改参考:http://www.foxtable.com/webhelp/topics/1533.htm,看第二段代码 Dim Cols1() As String = {"第一列","第二列","第三列","第四列"} Dim Cols2() As String = {"第一列值","第二列值","第三列值","第四列值"} For Each dr1 As DataRow In DataTables("表A").Select("[金额] > 100") 此项条件要怎么改,Cols1的各列值如果为“/",才复制到Cols2()对应列,否则不复制 Dim dr2 As DataRow = DataTables("表B").AddNew()
For i As Integer = 0 To Cols1.Length -1 dr2(Cols2(i)) = dr1(Cols1(i)) Next Next |
-- 作者:有点蓝 -- 发布时间:2020/10/24 8:56:00 -- dim r as row = e.table.current dim r2 as row = Tables("B").current if r is nothing orelse r2 is nothing then return Dim Cols1() As String = {"第一列","第二列","第三列","第四列"} Dim Cols2() As String = {"第一列值","第二列值","第三列值","第四列值"} For i As Integer = 0 To Cols1.Length -1 if r(Cols1(i)) = "/" then r2(Cols2(i)) = "/" end if next |