以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]调用的目标发生了异常。  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=121161)

--  作者:YDS
--  发布时间:2018/6/30 10:58:00
--  [求助]调用的目标发生了异常。
.NET Framework 版本:2.0.50727.5485
Foxtable 版本:2018.3.9.1
错误所在事件:表,报价明细,DataColChanged
详细错误信息:
调用的目标发生了异常。
未将对象引用设置到对象的实例。


此主题相关图片如下:01.jpg
按此在新窗口浏览图片

表事件

 

报价明细_DataColChanged

 

Dim b As String

Select Case e.DataCol.Name

    Case "订购数量","单价","折扣"

        Dim bh As String = e.DataRow("客户编号")

        If bh.StartsWith("X") Then

            If e.DataRow("产品名称").Contains("TX") Or e.DataRow("产品名称").Contains("碳纤") Then

                e.DataRow("佣金") = e.DataRow("单价") * e.DataRow("折扣") * e.DataRow("订购数量") * 0.05

            Else

                e.DataRow("佣金") = e.DataRow("单价") * e.DataRow("折扣") * e.DataRow("订购数量") * 0.1

            End If

        Else

            e.DataRow("佣金") = 0

        End If

        e.DataRow("折扣金额") = e.DataRow("单价") * (1 - e.DataRow("折扣")) * e.DataRow("订购数量")

        e.DataRow("总价") = e.DataRow("单价") * e.DataRow("折扣") * e.DataRow("订购数量") + e.DataRow("模具") + e.DataRow("工装") + e.DataRow("其他")

        msgbox(1)

        If Forms("报价").Opened Then

            msgbox(2)

            b = Forms("报价").Controls("ComboBox1").value

            Dim sl As Double = Tables("报价明细").Compute("Sum(订购数量)", "编号 = \'" & b & "\'")

            Dim zk As Double = Tables("报价明细").Compute("Sum(折扣金额)", "编号 = \'" & b & "\'")

            Dim tj As Double = Tables("报价明细").Compute("Sum(订购数量)", "编号 = \'" & b & "\' and 产品名称 like \'%J\'")

            tj = sl + tj

            Dim jg As Double = Tables("报价明细").Compute("Sum(总价)", "编号 = \'" & b & "\'")

            Dim sj As Double = jg * Forms("报价").Controls("ComboBox9").value

            Dim zj As Double = jg + sj + Forms("报价").Controls("ComboBox11").value + Forms("报价").Controls("ComboBox12").value

            Forms("报价").Controls("ComboBox01").value = zk

            Forms("报价").Controls("ComboBox10").value = tj

            Forms("报价").Controls("ComboBox13").value = sj

            Forms("报价").Controls("ComboBox14").value = zj

            Forms("报价").Controls("TextBox1").value = sl

            Forms("报价").Controls("TextBox2").value = jg

        ElseIf Forms("报价修改").Opened Then

            b = Forms("报价修改").Controls("ComboBox1").value

            Dim sl As Double = Tables("报价明细").Compute("Sum(订购数量)", "编号 = \'" & b & "\'")

            Dim zk As Double = Tables("报价明细").Compute("Sum(折扣金额)", "编号 = \'" & b & "\'")

            Dim tj As Double = Tables("报价明细").Compute("Sum(订购数量)", "编号 = \'" & b & "\' and 产品名称 like \'%J\'")

            tj = sl + tj

            Dim jg As Double = Tables("报价明细").Compute("Sum(总价)", "编号 = \'" & b & "\'")

            Dim sj As Double = jg * Forms("报价修改").Controls("ComboBox9").value

            Dim zj As Double = jg + sj + Forms("报价修改").Controls("ComboBox11").value + Forms("报价").Controls("ComboBox12").value

            Forms("报价修改").Controls("ComboBox01").value = zk

            Forms("报价修改").Controls("ComboBox10").value = tj

            Forms("报价修改").Controls("ComboBox13").value = sj

            Forms("报价修改").Controls("ComboBox14").value = zj

            Forms("报价修改").Controls("TextBox1").value = sl

            Forms("报价修改").Controls("TextBox2").value = jg

        End If

    Case "模具","工装","其他"

        e.DataRow("折扣金额") = e.DataRow("单价") * (1 - e.DataRow("折扣")) * e.DataRow("订购数量")

        e.DataRow("总价") = e.DataRow("单价") * e.DataRow("折扣") * e.DataRow("订购数量") + e.DataRow("模具") + e.DataRow("工装") + e.DataRow("其他")

        If Forms("报价").Opened Then

            b = Forms("报价").Controls("ComboBox1").value

            Dim jg As Double = Tables("报价明细").Compute("Sum(总价)", "编号 = \'" & b & "\'")

            Dim sj As Double = jg * Forms("报价").Controls("ComboBox9").value

            Dim zj As Double = jg + sj + Forms("报价").Controls("ComboBox11").value + Forms("报价").Controls("ComboBox12").value

            Forms("报价").Controls("ComboBox13").value = sj

            Forms("报价").Controls("ComboBox14").value = zj

            Forms("报价").Controls("TextBox2").value = jg

        ElseIf Forms("报价修改").Opened Then

            b = Forms("报价修改").Controls("ComboBox1").value

            Dim jg As Double = Tables("报价明细").Compute("Sum(总价)", "编号 = \'" & b & "\'")

            Dim sj As Double = jg * Forms("报价修改").Controls("ComboBox9").value

            Dim zj As Double = jg + sj + Forms("报价修改").Controls("ComboBox11").value + Forms("报价").Controls("ComboBox12").value

            Forms("报价修改").Controls("ComboBox13").value = sj

            Forms("报价修改").Controls("ComboBox14").value = zj

            Forms("报价修改").Controls("TextBox2").value = jg

        End If

End Select

 

 



--  作者:YDS
--  发布时间:2018/6/30 11:00:00
--  
msgbox(1) 正常  msgbox(2)  还没有出现就出现了异常
--  作者:有点蓝
--  发布时间:2018/6/30 11:17:00
--  
窗口名称确定是 “报价”?

这个地方也要改改

If bh.StartsWith("X") andalso e.DataRow.isnull("产品名称")=false Then

            If e.DataRow("产品名称").Contains("TX") Or e.DataRow("产品名称").Contains("碳纤") Then


--  作者:YDS
--  发布时间:2018/6/30 14:54:00
--  
好的   谢谢