点击查看按钮后,打开如下图所示的第二个页面,麻烦老师看看我的代码错在哪里DataTables("出库登记").Save() '接下来要根据主键查找,必须先保存,因为只有保存后新增行的主键才是有效值。
Dim id As String = e.Form.Controls("Label2").Text
Dim dr As DataRow = DataTables("出库登记").Find("[_Identify] = " & id)
If dr Is Nothing Then
DataTables("出库登记").AppendLoad("[_Identify] = " & id)
dr = DataTables("出库登记").Find("[_Identify] = " & id)
Else
dr.Load()
End If
If dr IsNot Nothing Then
Dim wz As Integer = Tables("出库登记").FindRow(dr)
If wz < 0 Then '如果因为筛选导致此送货单不可见
Tables("出库登记").Filter = ""
wz = Tables("出库登记").FindRow(dr)
End If
If wz >= 0 Then
Tables("出库登记").Position = wz
Forms("库存信息").Open()
If Forms("库存信息").opened Then
Dim Bar As WinForm.NavBar
Bar = e.Form.Controls("NavBar1")
Bar.SelectedIndex = 1
End If
End If
End If
e.Form.Close()
此主题相关图片如下:库存信息.png

此主题相关图片如下:查看.png

NavBar是"库存信息"窗口的?
Bar = e.Form.Controls("NavBar1")
改为
Bar = Forms("库存信息").Controls("NavBar1")