.NET Framework 版本:2.0.50727.5485
Foxtable 版本:2014.10.16.1
错误所在事件:窗口,监造周报窗口,AfterLoad
详细错误信息:
未将对象引用设置到对象的实例。
参照前面甜版和高手的指导,我依葫芦画瓢在AfterLoad中加了两个IF语句,整个AfterLoad代码如下:
但是修改后的代码在运行时发现大量占用内存,要等很长时间才能进入系统,但是没有报错。试着在表中维护数据,发现凡是在加载时表不为空,启动速度正常,但一旦为空,速度就非常慢。请高手看看我的代码是不是有缺陷?谢谢了!
If User.Group = "监理"
Then
DataTables("监造周报").LoadFilter = "监理人员 = '"
& User.Name & "'"
ElseIf User.Group = "主管" Then
DataTables("监造周报").LoadFilter = "项目经理 = '"
& User.Name & "'"
Else
DataTables("监造周报").LoadFilter = ""
End If
DataTables("监造周报").Load()
If Forms("监造周报窗口").Opened Then
'If Tables("监造周报").Current("审核") IsNot
Nothing Then
If Tables("监造周报").Current IsNot Nothing Then
Dim fm1 As WinForm.FileManager = Forms("监造周报窗口").Controls("FileManager1")
Dim fm2 As WinForm.FileManager = Forms("监造周报窗口").Controls("FileManager2")
Dim fm3 As WinForm.FileManager = Forms("监造周报窗口").Controls("FileManager3")
Dim fm As WinForm.PictureViewer = Forms("监造周报窗口").Controls("PictureViewer1")
If Tables("监造周报").Current.IsNull("审核") = False Then '如果周报已经审批
fm1.AddCommand.Visible = False
fm2.AddCommand.Visible = False
fm3.AddCommand.Visible = False
fm.AddCommand.Visible = False
fm1.DeleteCommand.Visible = False
fm2.DeleteCommand.Visible = False
fm3.DeleteCommand.Visible = False
fm.DeleteCommand.Visible = False
fm1.ClearCommand.Visible = False
fm2.ClearCommand.Visible = False
fm3.ClearCommand.Visible = False
fm.ClearCommand.Visible = False
fm.ManagerCommand.Visible = False
fm1.ManagerCommand.Visible = False
fm2.ManagerCommand.Visible = False
fm3.ManagerCommand.Visible = False
Else
fm1.AddCommand.Visible = True
fm2.AddCommand.Visible = True
fm3.AddCommand.Visible = True
fm.AddCommand.Visible = True
fm1.DeleteCommand.Visible = True
fm2.DeleteCommand.Visible = True
fm3.DeleteCommand.Visible = True
fm.DeleteCommand.Visible = True
fm.ManagerCommand.Visible = False
fm1.ManagerCommand.Visible = False
fm2.ManagerCommand.Visible = False
fm3.ManagerCommand.Visible = False
End If
End If
End If