以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  一个窗口中多个控件需要用同一个目录树,怎么办  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=14495)

--  作者:cqlwsam
--  发布时间:2011/11/21 22:11:00
--  一个窗口中多个控件需要用同一个目录树,怎么办
窗口5中出生地_省市、出生地_县区市、联系信息_省市、联系信息_县区市、联系信息_邮政编码、联系信息_区号、联系信息1_省市、联系信息1_县区市、联系信息1_邮政编码、联系信息1_区号、母亲_出生地(省市)、母亲_出生地(县区市)、母亲_联系地址(省市)、母亲_联系地址(县区市)、母亲_邮政编码、母亲_区号、父亲_出生地(省市)、父亲_出生地(县区市)、父亲_联系地址(省市)、父亲_联系地址(县区市)、父亲_邮政编码、父亲_区号等多个控件需要使用同一个目录树控件,我按开发指南中设置了,但提示有问题。有谁帮我看看。谢谢!
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目1.rar


--  作者:狐狸爸爸
--  发布时间:2011/11/22 8:14:00
--  

你的代码是:

 

If e.Node.Level = 1 Then \'如果单击的是第二层节点
    Dim ps() As String = e.Node.FullPath.Split("\\")
    Dim tr As Row = Tables("基本情况").Current
    Dim dr As DataRow = DataTables("行政区域").Find("省市 = \'" & ps(0) & "\' And 县市 = \'" & ps(1) & "\'")
    If dr IsNot Nothing Then \'如果在行政区域表找到对应的行,则将此行的值写入客户表的当前行.
        tr("出生地_省市") = dr("省市")
        tr("出生地_县区市") = dr("县市")
        tr("区号") = dr("区号")
        tr("邮编") = dr("邮编")
        e.Form.DropDownBox.Value = tr("省市") \'这行不是多余的,省略此行,无法在表中正常使用此下拉窗口输入数据.
    End If
    e.Form.DropDownBox.CloseDropdown()  \'关闭下拉目录树
End If

 

你的基本情况表并没有名为“区号”的列,只有一个名为“联系信息_区号”的列。

其他列名也请检查一下。


--  作者:cqlwsam
--  发布时间:2011/11/22 8:36:00
--  
因为基本情况中,很多地方都要引用。如:出生地_省市、联系信息_省市、联系信息1_省市、母亲_出生地(省市)、母亲_联系地址(省市)、父亲_出生地(省市)、父亲_联系地址(省市)等均要引用行政区域中的省市字段。是不是都要写出来。像这样: tr("出生地_省市") = dr("省市") tr("联系信息_省市") = dr("省市") tr("联系信息1_省市") = dr("省市") ....... 您提的那个我会修改。谢谢!
--  作者:狐狸爸爸
--  发布时间:2011/11/22 8:38:00
--  

是的,要都写出来。


--  作者:cqlwsam
--  发布时间:2011/11/22 12:52:00
--  
但是,又出现了问题,就是选了出生地_省市及出生地_县区市后,联系信息、联系信息1、母亲_后面有关的控件中的内容同步更新了,不能单独选。不知道怎么了。是不是代码有问题?我的代码是: If e.Node.Level = 1 Then Dim ps() As String = e.Node.FullPath.Split("\\") Dim tr As Row = Tables("基本情况").Current Dim dr As DataRow = DataTables("行政区域").Find("省市 = \'" & ps(0) & "\' And 县市 = \'" & ps(1) & "\'") If dr IsNot Nothing Then tr("出生地_省市") = dr("省市") tr("出生地_县区市") = dr("县市") e.Form.DropDownBox.Value = tr("出生地_省市") End If e.Form.DropDownBox.CloseDropdown() End If If e.Node.Level = 1 Then Dim ps() As String = e.Node.FullPath.Split("\\") Dim tr As Row = Tables("基本情况").Current Dim dr As DataRow = DataTables("行政区域").Find("省市 = \'" & ps(0) & "\' And 县市 = \'" & ps(1) & "\'") If dr IsNot Nothing Then tr("联系信息_省市") = dr("省市") tr("联系信息_县市区")= dr("县市") tr("联系信息_区号") = dr("区号") tr("联系信息_邮政编码") = dr("邮编") e.Form.DropDownBox.Value = tr("联系信息_省市") End If e.Form.DropDownBox.CloseDropdown() End If If e.Node.Level = 1 Then \'如果单击的是第二层节点 Dim ps() As String = e.Node.FullPath.Split("\\") Dim tr As Row = Tables("基本情况").Current Dim dr As DataRow = DataTables("行政区域").Find("省市 = \'" & ps(0) & "\' And 县市 = \'" & ps(1) & "\'") If dr IsNot Nothing Then \'如果在行政区域表找到对应的行,则将此行的值写入客户表的当前行. tr("联系信息1_省市") = dr("省市") tr("联系信息1_县市区")= dr("县市") tr("联系信息1_区号") = dr("区号") tr("联系信息1_邮政编码") = dr("邮编") e.Form.DropDownBox.Value = tr("联系信息1_省市") End If e.Form.DropDownBox.CloseDropdown() End If If e.Node.Level = 1 Then Dim ps() As String = e.Node.FullPath.Split("\\") Dim tr As Row = Tables("基本情况").Current Dim dr As DataRow = DataTables("行政区域").Find("省市 = \'" & ps(0) & "\' And 县市 = \'" & ps(1) & "\'") If dr IsNot Nothing Then tr("母亲_出生地(省市)") = dr("省市") tr("母亲_出生地(县市区)") = dr("县市") e.Form.DropDownBox.Value = tr("母亲_出生地(省市)") End If e.Form.DropDownBox.CloseDropdown() End If If e.Node.Level = 1 Then Dim ps() As String = e.Node.FullPath.Split("\\") Dim tr As Row = Tables("基本情况").Current Dim dr As DataRow = DataTables("行政区域").Find("省市 = \'" & ps(0) & "\' And 县市 = \'" & ps(1) & "\'") If dr IsNot Nothing Then tr("母亲_联系地址(省市)") = dr("省市") tr("联系信息1_邮政编码") = dr("邮编") tr("母亲_联系地址(县市区)") = dr("县市") tr("母亲_区号") = dr("区号") tr("母亲_邮政编码") = dr("邮编") e.Form.DropDownBox.Value = tr("母亲_联系地址(省市)") End If e.Form.DropDownBox.CloseDropdown() End If If e.Node.Level = 1 Then Dim ps() As String = e.Node.FullPath.Split("\\") Dim tr As Row = Tables("基本情况").Current Dim dr As DataRow = DataTables("行政区域").Find("省市 = \'" & ps(0) & "\' And 县市 = \'" & ps(1) & "\'") If dr IsNot Nothing Then tr("父亲_出生地(省市)")= dr("省市") tr("父亲_联系地址(省市)")= dr("省市") e.Form.DropDownBox.Value = tr("父亲_出生地(省市)") End If e.Form.DropDownBox.CloseDropdown() End If If e.Node.Level = 1 Then Dim ps() As String = e.Node.FullPath.Split("\\") Dim tr As Row = Tables("基本情况").Current Dim dr As DataRow = DataTables("行政区域").Find("省市 = \'" & ps(0) & "\' And 县市 = \'" & ps(1) & "\'") If dr IsNot Nothing Then tr("父亲_出生地(县市区)") = dr("县市") tr("父亲_联系地址(县市区)") = dr("县市") tr("父亲_区号") = dr("区号") tr("父亲_邮政编码") = dr("邮编") e.Form.DropDownBox.Value = tr("父亲_联系地址(省市)") End If e.Form.DropDownBox.CloseDropdown() End If
[此贴子已经被作者于2011-11-22 13:16:23编辑过]