以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助] (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=31900) |
-- 作者:cqlpjks -- 发布时间:2013/4/22 18:11:00 -- [求助] If e.DataCol.Name = "单位" Then \'如果内容发生变动的是单位列 这是只有“单位”发生变化时,“目标1”列的填充。当“单位”、“年级”、“部别”都发生变化时如何修改代码,即要同时满足:单位=单位、年级=年级、部别=部别。请指教,谢谢! |
-- 作者:fjlclxj -- 发布时间:2013/4/22 22:33:00 -- Dim ls1() As String={"单位","年级","部别"} Dim dr As DataRow Dim ls As New List(of String) ls.AddRange(ls1) Dim n As String = e.DataCol.Name If ls.Contains(e.DataCol.Name) Then If e.NewValue Is Nothing Then \'如果新值是空白 e.DataRow("目标1") = Nothing \'那么清空此行目标1列的内容 Else \'否则在产品表查找同名的产品行,将找到的行赋值给变量dr ls.Remove(n) dr = DataTables("校名设置").Find("[" & n & "] = \'" & e.NewValue & "\' and [" & ls(0) & "]=\'" & e.DataRow(ls(0)) & "\' And [" & ls(1) & "]=\'" & e.DataRow(ls(1)) & "\'") If dr IsNot Nothing Then \'如果找到了同名的产品行,也就是dr不是Nothing e.DataRow("目标1") = dr("目标1") End If End If End If
|