以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]DataColChanged事件代码改成按钮代码(已解决)  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=68138)

--  作者:yyzlxc
--  发布时间:2015/5/11 9:13:00
--  [求助]DataColChanged事件代码改成按钮代码(已解决)
有一段DataColChanged事件代码,想用按钮代码来替代,如何修改代码,请各位老师指教,谢谢!!
DataColChanged事件代码

If e.DataCol.name = "工位编号" Then
   If e.DataRow.IsNull("工位编号") = False
       Dim gwbh As String = e.DataRow("工位编号")
       Dim cpkh As String = RibbonTabs("工艺管理")("工位").Items("产品款号").Text
       e.DataRow("工序编号") = DataTables("资料").GetComboListString("工序编号","(工位编号 = \'" & gwbh & "\' or 工位编号 like \'" & gwbh & "_%\' or 工位编号 like \'%_" & gwbh & "\' or 工位编号 like \'%_" & gwbh & "_%\') and 产品款号 = \'"& cpkh &"\'").Replace("|","_")
   End If
End If



按钮代码

For Each dr As DataRow In DataTables("工位").DataRows
    If dr.IsNull("工位编号") Then
        dr("工序编号") = Nothing
    Else
        Dim pr As DataRow = DataTables("资料").Find("工位编号 = \'" & dr("工位编号") & "\' and 产品款号 = \'"& cpkh &"\'")
        If pr IsNot Nothing Then
            dr("工序编号") = pr("工序编号")
        Else
            dr("工序编号") = Nothing
        End If
    End If
Next
[此贴子已经被作者于2015/5/11 9:47:34编辑过]

--  作者:Bin
--  发布时间:2015/5/11 9:17:00
--  
For Each dr As DataRow In DataTables("工位").DataRows
If dr.IsNull("工位编号") = False
       Dim gwbh As String = dr("工位编号")
       Dim cpkh As String = RibbonTabs("工艺管理")("工位").Items("产品款号").Text
       dr("工序编号") = DataTables("资料").GetComboListString("工序编号","(工位编号 = \'" & gwbh & "\' or 工位编号 like \'" & gwbh & "_%\' or 工位编号 like \'%_" & gwbh & "\' or 工位编号 like \'%_" & gwbh & "_%\') and 产品款号 = \'"& cpkh &"\'").Replace("|","_")
   End If
next

--  作者:yyzlxc
--  发布时间:2015/5/11 9:47:00
--  
谢谢Bin老师的指教,问题解决。