以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  没有加载行时出错  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=58502)

--  作者:audience68
--  发布时间:2014/10/17 16:47:00
--  没有加载行时出错
新建一个用户,在加载时程序报错,主要是新用户还没有录入信息,所以无法加载该用户的行项目,不知如何避免呐?请教高手。出错的信息如下

.NET Framework 版本:2.0.50727.5485

Foxtable 版本:2014.10.16.1

错误所在事件:监造日志,CurrentChanged

详细错误信息:

未将对象引用设置到对象的实例。

 

CurrentChanged的代码如下:

If Forms("监造日志窗口").Opened Then

    Dim fm As WinForm.FileManager = Forms("监造日志窗口").Controls("FileManager1")

 

    Dim tv As Date = Tables("监造日志").Current("填报日期")

    Dim tp As TimeSpan = Date.Today - tv 

    If tp.TotalDays >= 1 Then \'如果订单已经超过1     

        forms("监造日志窗口").controls("TextBox1").Enabled=False    

        fm.DeleteCommand.Visible = False

        fm.ClearCommand.Visible = False

        fm.AddCommand.Visible = False

    Else     

        forms("监造日志窗口").controls("TextBox1").Enabled=True     

        fm.DeleteCommand.Visible = True

        fm.ClearCommand.Visible = True

        fm.AddCommand.Visible = True

    End If

End If

 

If Forms("监造日志窗口").Opened Then

    Dim fn As WinForm.PictureViewer = Forms("监造日志窗口").Controls("PictureViewer1")

    Dim tv As Date = Tables("监造日志").Current("填报日期")

    Dim tp As TimeSpan = Date.Today - tv 

    If tp.TotalDays >= 1 Then \'如果订单已经超过1     

        fn.DeleteCommand.Visible = False

        fn.ClearCommand.Visible = False

        fn.AddCommand.Visible = False

    Else      

        fn.DeleteCommand.Visible = True

        fn.ClearCommand.Visible = True

        fn.AddCommand.Visible = True

    End If


--  作者:Bin
--  发布时间:2014/10/17 16:48:00
--  

if Tables("监造日志").Current isnot nothing then

Dim tv As Date = Tables("监造日志").Current("填报日期")

    

    Dim tp As TimeSpan = Date.Today - tv 

    If tp.TotalDays >= 1 Then \'如果订单已经超过1     

        forms("监造日志窗口").controls("TextBox1").Enabled=False    

        fm.DeleteCommand.Visible = False

        fm.ClearCommand.Visible = False

        fm.AddCommand.Visible = False

    Else     

        forms("监造日志窗口").controls("TextBox1").Enabled=True     

        fm.DeleteCommand.Visible = True

        fm.ClearCommand.Visible = True

        fm.AddCommand.Visible = True

    End If

end if


--  作者:audience68
--  发布时间:2014/10/17 16:59:00
--  
谢谢BIN