以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 子表列值判断 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=96070) |
-- 作者:yupeng -- 发布时间:2017/2/12 14:09:00 -- 子表列值判断 老师 新年好 子表,比如此子表共有3行,我要判断这3行中,"类型"列的值 是否有等于 "ABC",如果有,则执行后面的代码? 请问老师要怎样写代码?
谢谢 |
-- 作者:wyz20130512 -- 发布时间:2017/2/12 14:57:00 -- 代码写在父表的CurrentChanged事件中 Dim r As Row = e.Table.Current Dim drs As New List(Of DataRow) = r.DataRow.GetChildRows("子表名") For Each dr As DataRow In drs If dr("类型") = "ABC" Then Exit For End If Next
|
-- 作者:有点色 -- 发布时间:2017/2/12 15:31:00 -- Dim r As Row = Tables("表a").current dim has as boolean = false Dim drs As List(Of DataRow) = r.DataRow.GetChildRows("子表名") For Each dr As DataRow In drs If dr("类型") = "ABC" Then has = True Exit For End If Next If has Then msgbox(1) Else msgbox(2) End If |