Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共6 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:下拉目录树

1楼
1234567 发表于:2024/10/31 12:44:00

Object reference not set to an instance of an object.

DropDownBox控件打开目录树错误

 

NodeMouseClick

If e.Node.Level = 1 Then
    Dim tr As Row
    Dim dr As DataRow = e.Node.DataRow
    If e.Form.DropTable IsNot Nothing Then
        tr = e.Form.DropTable.Current
    Else
        Dim nm As String = e.Form.DropDownBox.BindingField
        nm = nm.Split(".")(0)
        tr = Tables(nm).Current
    End If
    tr("工序") = dr("工序")
    tr("工步") = dr("工步")
    e.Form.DropDownBox.Value = tr("工步")
    e.Form.DropDownBox.CloseDropdown()
End If

2楼
有点蓝 发表于:2024/10/31 13:27:00
调试

If e.Node.Level = 1 Then
    Dim tr As Row
msgbox(e.Node.DataRow is nothing)
    Dim dr As DataRow = e.Node.DataRow
    If e.Form.DropTable IsNot Nothing Then
        tr = e.Form.DropTable.Current
    Else
        Dim nm As String = e.Form.DropDownBox.BindingField
        nm = nm.Split(".")(0)
        tr = Tables(nm).Current
    End If
msgbox(tr is nothing)
    tr("工序") = dr("工序")
    tr("工步") = dr("工步")
    e.Form.DropDownBox.Value = tr("工步")
    e.Form.DropDownBox.CloseDropdown()
End If
3楼
1234567 发表于:2024/10/31 13:42:00

If e.Node.Level = 1 Then
    Dim tr As Row
    msgbox(e.Node.DataRow Is Nothing)          false
    Dim dr As DataRow = e.Node.DataRow
    MessageBox.Show(1) 
    If e.Form.DropTable IsNot Nothing Then
        MessageBox.Show(2)   
        tr = e.Form.DropTable.Current
        MessageBox.Show(3)   
    Else
        Dim nm As String = e.Form.DropDownBox.BindingField
        MessageBox.Show(4)   显示4后,报警 Object reference not set to an instance of an object.
        nm = nm.Split(".")(0)
        MessageBox.Show(5) 
        tr = Tables(nm).Current
        MessageBox.Show(6)
    End If
    msgbox(tr Is Nothing)
    tr("工序") = dr("工序")
    tr("工步") = dr("工步")
    e.Form.DropDownBox.Value = tr("工步")
    e.Form.DropDownBox.CloseDropdown()
End If
4楼
有点蓝 发表于:2024/10/31 13:53:00
这个控件没有做绑定
5楼
1234567 发表于:2024/10/31 14:16:00

能否加一个判断,如果控件没有绑定,就执行e.Form.DropDownBox.Value = dr("工步")

6楼
有点蓝 发表于:2024/10/31 14:23:00
if e.Form.DropDownBox.BindingField > "" then
有绑定
else
无绑定
end if
共6 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .03516 s, 2 queries.