1、尽量不要使用GoTo这种地狱用法,如果符合条件才执行,建议这样
If wo Isnot Nothing Then
Tables("CellKanban_Table3").Filter = "WOID = '" & wo & "'"
……
end if
2、在主表事件里不要使用e.form这种用法,应该指定窗口名称,并且要判断窗口是否已经打开
'变更schedule,将工序信息写入下方表中
'MessageBox.Show(1)
If Not DataTables.Contains("WorkOrderStatus") Then
DataTables.Load("WorkOrderStatus")
End If
Dim wo As String
Dim r As Row = e.Table.Current
If r Is Nothing Then Return
'MessageBox.Show("2")
wo = r("WO")
Tables("CellKanban_Table2").Filter = "[wo]='" & wo & "'"
If Not DataTables.Contains("Production_List") Then
DataTables.Load("Production_List")
End If
If wo IsNot Nothing AndAlso Forms("CellKanban").Opened Then
Tables("CellKanban_Table3").Filter = "WOID = '" & wo & "'"
Tables("CellKanban_Table3").sort = "OPSeq,CLOCKIN"
Dim PN As String = r("PartID")
Dim Pbx As WinForm.PictureBox = Forms("CellKanban").Controls("PictureBox1")
Dim fpf As String
Dim fp As String = "P:\General documents\Setup\Pic\" '\\freenas01chi\Production\General documents\Setup\Pic\
fpf = fp & PN & ".jpg"
If FileSys.FileExists(fpf) = False Then
fp = "T:\ME\ME Documentation\Picture\" '\\domain.pragon\china\ME\ME Documentation\Picture\" & PN & ".jpg"
fpf = fp & PN & ".jpg"
If FileSys.FileExists(fpf) = False Then
fpf = "P:\General documents\Setup\Pic\Error.jpg"
End If
End If
pbx.ImageFile = fpf
pbx.SizeMode = ImageSizeMode.Zoom
End if