以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  select 使用  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=145852)

--  作者:kaituozhe
--  发布时间:2020/2/9 16:06:00
--  select 使用

Dim filter7 As String = "会计科目编码 = \'" & e.DataRow("会计科目编码") & "\'and  账面会计科目编码 = \'" & e.DataRow("账面会计科目编码") & "\'and 日期 >= \'" & e.DataRow("开始日期") & "\'and 日期 <= \'" & e.DataRow("截止日期") & "\'and 公司名称 = \'" & e.DataRow("公司名称") & "\'"
Dim st As Date = Date.Now \'将开始时间保存在变量st中
Sel ect Case e.DataCol.name
    Case "会计科目编码"
        msgbox(1)
        If e.DataRow.Isnull("会计科目编码") = False  Then
            msgbox(2)
            e.DataRow("科目编号") = e.DataRow("会计科目编码").SubString(0,e.DataRow("会计科目编码").IndexOf("_"))
            msgbox(3)
            Dim bh() As String = (e.DataRow("会计科目编码").SubString(e.DataRow("会计科目编码").IndexOf("_")+1,e.DataRow("会计科目编码").Length - e.DataRow("会计科目编码").IndexOf("_")-1)).split(".")
            e.DataRow("项目编号") = bh(0)
           
            \'msgbox(e.DataRow("科目编号") )
            \'msgbox(e.DataRow("项目编号"))
        Else
            \'e.DataRow("科目编号") = Nothing
            \'e.DataRow("项目编号") = Nothing
        End If
        msgbox(4)
End Select
msgbox(5)
MessageBox.Show("耗时: " & (Date.Now - st).TotalSeconds & "秒") \'计算并显示执行代码所花费的秒数
msgbox(6)

 

执行上述代码 ,实际执行结果为:1-2-5-t-6-3-5-t-6-4-5-t-6,为什么不是1-2-3-4-5-t-6,这是什么原因?

 


--  作者:有点蓝
--  发布时间:2020/2/9 22:43:00
--  
正常啊,任何数据列值改变都会触发datacolchanged事件,msgbox(2)给"科目编号"赋值,同时会触发datacolchanged事件,事件判断没有针对  case "科目编号"的代码,就接着执行End Select之后的代码,完毕后回到之前的事件,继续执行msgbox(3)