下面是一个通用代码来解决主表与窗口副表行位置联动,请老师审核一下是否有问题,我测试还可以?
''表A选定某行时,副本Table也能同步选定同一样
For Each frm As WinForm.Form In Forms ‘遍历所有窗口
If frm.Opened() Then ‘判断窗口已打开
For Each ct As Object In frm.Controls
If Typeof ct Is WinForm.Table Then
If ct.Visible = True AndAlso ct.Table.DataTable.Name.Contains(e.Table.DataTable.Name) Then
If e.Table.Current Is Nothing Then Return
Dim dr1
As DataRow =
e.Table.Current.DataRow
Dim wz1
As Integer =
ct.Table.FindRow(dr1)
If wz1
>= 0 Then
Systemready = False
ct.Table.Position = wz1
Systemready = True
e.Table.Refresh '表的行标不显示问题
End If
End If
End If
Next
End If
Next