一个窗口。控件RecordGrid1绑定A表;控件Table也绑定A表为副本(定义为bm2)。
希望在A表中克隆一条记录。在bm2副表中对应的记录也成为当前行。采用方法如下:
Dim bm2 As String= e.Form.Name & "_table2"
Dim s As Row=Tables("A表").Current
If s Is Nothing Then Return
Dim r As Row= Tables("A表").AddNew()
For Each m As Col In Tables("产品").cols
If m.name="产品编码" Then Continue For ‘直接克隆重复控制会告警
r(m.Name)=s(m.Name)
Next
Dim ra As DataRow=DataTables("产品").find("产品编码 Is Null") '"[_Identify]='" & r("_Identify") & "'")
If ra IsNot Nothing Then
Dim wz As Integer=Tables(bm2).FindRow(ra)
If wz>=0 Then
Tables(bm2).Position=wz
End If
End If
这种方法没有使bm2新增行为当前行,怎么能达到目的?谢谢