以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]各位大神帮忙看看,提示引用的未设置到对象实例  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=70435)

--  作者:ZDG
--  发布时间:2015/6/21 20:12:00
--  [求助]各位大神帮忙看看,提示引用的未设置到对象实例
If e.Form.Controls("品号").text="" Then
    MessageBox.Show("物料编号不能为空")
Else
    If e.Form.controls("助记码").text="" Then
        messageBox.show("助记码不能为空")
    Else
        If e.form.controls("品名").text="" Then
            messageBox.show("物料名称不能为空")
        Else
            If e.form.controls("主要仓库").text="" Then
                messagebox.show("主要仓库不能为空")
            Else
                If e.Form.controls("主供货商").text="" Then
                    messagebox.show("主供应商不能为空")
                Else
                    Dim cr As Row = Tables("品号信息").current
                    If Tables("品号信息").current.Locked = False Then
                        cr("品号")=e.ForM.controls("品号").text
                        cr("品名")=e.ForM.controls("品名").text
                        cr("助记码")=e.ForM.controls("助记码").text
                        cr("主要仓库")=e.ForM.controls("主要仓库").text
                        cr("主供货商")=e.Form.controls("主供货商")
                        cr.Locked=True
                        e.Form.Controls("品号").text=""
                        e.Form.Controls("品名").text=""
                        e.Form.Controls("助记码").text=""
                        e.Form.Controls("主要仓库").text=""
                        e.Form.Controls("主供货商").text=""
                        e.Form.Controls("品号").ReadOnly = BooleanEnum.True
                        e.Form.Controls("品名").ReadOnly = BooleanEnum.True
                        e.Form.Controls("助记码").ReadOnly = BooleanEnum.True
                        e.Form.Controls("主要仓库").ReadOnly = BooleanEnum.True
                        e.Form.controls("主供货商").ReadOnly = BooleanEnum.True
                    Else
                        Dim nr As Row = Tables("品号信息").AddNew
                        nr("品号")=e.ForM.controls("品号").text
                        nr("品名")=e.ForM.controls("品名").text
                        nr("助记码")=e.ForM.controls("助记码").text
                        nr("主要仓库")=e.ForM.controls("主要仓库").text
                        nr("主供货商")=e.Form.controls("主供货商").text
                        e.Form.Controls("品号").text=""
                        e.Form.Controls("品名").text=""
                        e.Form.Controls("助记码").text=""
                        e.Form.Controls("主要仓库").text=""
                        e.Form.controls("主供货商").text=""
                        e.Form.Controls("品号").ReadOnly = BooleanEnum.True
                        e.Form.Controls("品名").ReadOnly = BooleanEnum.True
                        e.Form.Controls("助记码").ReadOnly = BooleanEnum.True
                        e.Form.Controls("主要仓库").ReadOnly = BooleanEnum.True
                        e.Form.controls("主供货商").ReadOnly = BooleanEnum.True
                        nr.Locked = True
                    End If
                End If
            End If
        End If
    End If

--  作者:Bin
--  发布时间:2015/6/23 8:58:00
--  
窗口未打开?

建议您用这个方法:
http://www.foxtable.com/help/topics/1485.htm

先找出是哪一行出错,然后分析原因,搞不定,可以在论坛发帖,贴出代码,并告诉我们运行到哪一行出错,以及错误提示。