以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助] DataColChanging  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=119292)

--  作者:cool314156
--  发布时间:2018/5/22 10:50:00
--  [求助] DataColChanging
表的DataColChanging事件代码设置为
Dim hwh2 As DataRow = e.DataRow
If e.DataCol.Name = "货位号" Then
    msgbox(3)
    hwh2 = e.DataTable.Find("货位号 = \'" & e.NewValue & "\'And 货位号 not In (\'77777777\', \'88888888\', \'99999999\')  ")
    msgbox(2)
    If hwh2("货位号")  IsNot Nothing Then
        MessageBox.Show("此货位号已经存在!")
        If  hwh2("商品编号") =e.DataRow("商品编号") AndAlso hwh2("批号") =e.DataRow("批号")  Then
            MessageBox.Show("此货位号可以使用!")
        Else
            MessageBox.Show("此货位号已经占用!")
            e.Cancel = True
        End If
    End If
End If
测试了下,输入77777777或者88888888或者99999999就弹出错误报告
 .NET Framework 版本:2.0.50727.3655
Foxtable 版本:2018.3.9.1
错误所在事件:表,库存,DataColChanging
详细错误信息:
Exception has been thrown by the target of an invocation.
Object reference not set to an instance of an object.
求教下这个错在哪里了 
[此贴子已经被作者于2018/5/22 10:50:07编辑过]

--  作者:有点甜
--  发布时间:2018/5/22 10:54:00
--  

If hwh2("货位号")  IsNot Nothing Then

 

改成

 

If hwh2 IsNot Nothing Then


--  作者:cool314156
--  发布时间:2018/5/22 11:13:00
--  
谢谢了