以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  blackzhu 请进···  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=8222)

--  作者:mr725
--  发布时间:2010/9/18 20:28:00
--  blackzhu 请进···

前天你说: 奇怪了,为什么刷新列没有用?一列一列刷新可以.  下面就可以整列刷新啦:

你也是老狐先生了,应该看得出为什么刷新列没有用的原因了

 

If e.DataCol.Name = "产品" Then
    If e.DataRow.IsNull("产品") Then 
        e.DataRow("出货明细") = Nothing 
    Else
        Dim mx As String
        Dim drs As List(Of DataRow)
        drs = DataTables("出货明细").Select("[公司] = \'" & e.DataRow("公司") & "\'")
        For Each dr As DataRow In drs
            mx = mx & dr("出货时间") & " " &  dr("出货数量") & vbCrLf
        Next
        e.DataRow("出货明细") = ""
        e.DataRow("出货明细") = mx
    End If
End If


--  作者:mr725
--  发布时间:2010/9/18 20:56:00
--  

 

如果你想在产品列发生变化后,时时刷新整列可以这样(也就是说不需要重置列了):

 

If e.DataCol.Name = "产品" Then   
    If e.DataRow.IsNull("产品") Then
        e.DataRow("出货明细") = Nothing
    Else
        Dim mx As String
        Dim drs As List(Of DataRow)  
        For Each dr0 As DataRow In DataTables("表A").datarows           
            drs = DataTables("出货明细").Select("[公司] = \'" & dr0("公司") & "\'")
            For Each dr As DataRow In drs
                mx = mx & dr("出货时间") & " " &  dr("出货数量") & vbCrLf
            Next
            dr0("出货明细") = ""
            dr0("出货明细") = mx
            mx = ""
        Next       
    End If
End If


--  作者:狐狸爸爸
--  发布时间:2010/9/19 8:08:00
--  

呵呵,向Mr725兄的热心、认真、负责学习。

[此贴子已经被作者于2010-9-19 8:08:43编辑过]

--  作者:blackzhu
--  发布时间:2010/9/20 7:54:00
--  
我说MR-725老兄是大师吗,我比较笨,代码学来学去,不会灵活贯通.