佩服!謝謝!非常感謝您!還有我加了按鈕也是有問題,原因我找到了(紅字標示)
Dim drs As List(of DataRow)
Dim dr1,dr2 As DataRow
Dim dt As DataTable = DataTables("庫存信息表")
dt.StopRedraw
drs =dt.Select("產品編號 > ''")
If drs.count > 0 Then
For Each dr1 In drs
dr1("統計數量") = Nothing
Next
End If
drs =DataTables("訂單明細").Select("原主件 > ''")
If drs.count > 0 Then
For Each dr1 In drs
For Each s1 As String In dr1("原主件").split(",")
dr2=dt.Find("產品編號 ='" & s1 & "'")
If dr2 IsNot Nothing Then
dr2("統計數量")+ =dr1("數量")
End If
Next
Next
End If
dt.ResumeRedraw