下面是我项目中的一段写入代码,功能是将窗口中得到的查询表写入到 Tables("销售出库") 给你参考一下
Dim tb1 As Table = Tables(e.Form.Name & "_Table1")
Dim tb2 As Table = Tables("销售出库")
If tb1.Current IsNot Nothing Then
For Each r As Row In tb1.Rows
If r.Checked = True Then
tb2.AddNew
tb2.Current("类别") = e.Form.Controls("Label_类别内容").Text
tb2.Current("合同主号") = e.Form.Controls("Label_合同主号内容").Text
tb2.Current("往来合同") = e.Form.Controls("Label_合同号内容").Text
tb2.Current("品名") = r("品名")
tb2.Current("牌号") = r("本厂牌号")
tb2.Current("出厂牌号") = e.Form.Controls("Label_合同牌号内容").Text
tb2.Current("卷号") = r("卷号")
tb2.Current("厚度") = r("厚度")
tb2.Current("宽度") = r("宽度")
tb2.Current("重量") = r("重量")
tb2.Current("硬度评级") = r("硬度评级")
tb2.Current("套筒重量") = r("套筒重量")
tb2.Current("母卷号") = r("母卷号")
tb2.Current("生产质量记录") = r("生产质量记录")
tb2.Current("凭证号") = r("入库记录标记")
tb2.Current("主办人") = e.Form.Controls("Label_销售人员内容").Text
tb2.Current("往来公司") = e.Form.Controls("Label_客户名内容").Text
tb2.Current("往来公司代码") = e.Form.Controls("Label_公司代码内容").Text
tb2.Current("收货人") = e.Form.Controls("Label_收货人内容").Text
tb2.Current("收货人电话") = e.Form.Controls("Label_收货人电话内容").Text
tb2.Current("收货地址") = e.Form.Controls("Label_收货地址内容").Text
End If
Next
End If
For i As Integer = tb1.GetCheckedRows.count - 1 To 0 Step -1
tb1.GetCheckedRows(i).remove
Next
If tb1.Current IsNot Nothing Then
Dim t As Table = Tables(e.Form.Name & "_Table1")
Dim g As Subtotalgroup
t.SubtotalGroups.Clear()
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "*"
g.TotalOn = "重量"
g.Caption = "总计"
t.SubtotalGroups.Add(g)
t.Subtotal()
Else
tb1.ClearSubtotal()
End If