Foxtable(狐表)用户栏目专家坐堂 → Object reference not set to an instance of an object


  共有2418人关注过本帖树形打印复制链接

主题:Object reference not set to an instance of an object

帅哥哟,离线,有人找我吗?
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:109736 积分:558396 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2023/8/23 13:34:00 [显示全部帖子]

Schedule是不是在窗口有副本表,副本是不是也有CurrentChanged事件代码

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:109736 积分:558396 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2023/8/23 16:19:00 [显示全部帖子]

表面看不出什么问题,请上传实例测试

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:109736 积分:558396 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2023/8/23 17:40:00 [显示全部帖子]

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

 回到顶部