以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  重命名目录树节点问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=72770)

--  作者:水青树叶
--  发布时间:2015/8/5 22:25:00
--  重命名目录树节点问题

重命名目录树节点的代码,请大神帮看看问题出在哪?


--  作者:水青树叶
--  发布时间:2015/8/5 22:26:00
--  
以下内容为程序代码:

1 做了一个这样的目录树,单击重命名按键打开下面的窗口,用于修改目录树和对应表的内容,但好象没用,请大神们看看什么地方出了问题?
2
3
4
5
6
7 窗口表事件
8
9 窗口与控件事件
10
11 修改区划单位_AfterLoad
12
13 Dim lb1 As WinForm.Label = e.Form.Controls("Label1")
14 Dim lb2 As WinForm.Label = e.Form.Controls("Label2")
15 Dim lb3 As WinForm.Label = e.Form.Controls("Label3")
16 Dim lb4 As WinForm.Label = e.Form.Controls("Label4")
17 If Forms("行政区划").Opened Then
18 Dim trv As WinForm.TreeView = Forms("行政区划").Controls("TreeView1")
19 Dim nd As WinForm.TreeNode = trv.SelectedNode
20 Select Case nd.Level
21 Case 0
22 lb1.Text = "原县代码:"
23 lb2.Text = "原县名:"
24 lb3.Text = "新县代码:"
25 lb4.Text = "新县名:"
26 e.Form.Controls("TextBox1").Value = nd.Name
27 e.Form.Controls("TextBox2").Value = nd.Text
28 e.Form.Controls("TextBox3").Value =nd.Name
29 e.Form.Controls("TextBox4").Value =nd.Text
30 Case 1
31 lb1.Text = "原乡镇代码:"
32 lb2.Text = "原乡镇名称:"
33 lb3.Text = "新乡镇代码:"
34 lb4.Text = "新乡镇名称:"
35 e.Form.Controls("TextBox1").Value = nd.Name
36 e.Form.Controls("TextBox2").Value = nd.Text
37 e.Form.Controls("TextBox3").Value =nd.Name
38 e.Form.Controls("TextBox4").Value =nd.Text
39 Case 2
40 lb1.Text = "原村代码:"
41 lb2.Text = "原村名:"
42 lb3.Text = "新村代码:"
43 lb4.Text = "新村名:"
44 e.Form.Controls("TextBox1").Value = nd.Name
45 e.Form.Controls("TextBox2").Value = nd.Text
46 e.Form.Controls("TextBox3").Value =nd.Name
47 e.Form.Controls("TextBox4").Value =nd.Text
48 End Select
49 End If
50
51 修改区划单位_Button1_Click
52
53 If Forms("行政区划").Opened Then
54 Dim trv As WinForm.TreeView = Forms("行政区划").Controls("TreeView1")
55 Dim nd As WinForm.TreeNode = trv.SelectedNode
56 Dim ydm As String = e.Form.Controls("TextBox1").Value
57 Dim xdm As String = e.Form.Controls("TextBox3").Value
58 Dim xmc As String = e.Form.Controls("TextBox4").Value
59
60 If nd.Level = 0 Then
61 Dim dr As DataRow
62 dr = DataTables("县级区划单位").Find("[县代码] = \'" & ydm & "\'")
63 If dr IsNot Nothing Then
64 dr("县代码") = xdm
65 dr("县名") = xmc
66 End If
67 nd.Name = xdm
68 nd.Name = xmc
69 Dim fn As String = ProjectPath & "行政区划.foxtr"
70 Trv.Save(fn)
71 Else If nd.level = 1 Then
72 Dim dr As DataRow
73 dr = DataTables("乡镇").Find("[乡镇代码] = \'" & ydm & "\'")
74 If dr IsNot Nothing Then
75 dr("乡镇代码") = xdm
76 dr("乡镇名称") = xmc
77 End If
78 nd.Name = xdm
79 nd.Name = xmc
80 Dim fn As String = ProjectPath & "行政区划.foxtr"
81 Trv.Save(fn)
82 Else If nd.level = 2 Then
83 Dim dr As DataRow
84 dr = DataTables("村").Find("[村代码] = \'" & ydm & "\'")
85 If dr IsNot Nothing Then
86 dr("村代码") = xdm
87 dr("村名") = xmc
88 End If
89 nd.Name = xdm
90 nd.Name = xmc
91 Dim fn As String = ProjectPath & "行政区划.foxtr"
92 Trv.Save(fn)
93 Else
94 e.Form.Close()
95 End If
96 End If
97 e.Form.Close()
98
99 修改区划单位_Button2_Click
100
101 e.Form.Close()
102
103
104

--  作者:大红袍
--  发布时间:2015/8/5 22:36:00
--  

 呃,代码看不出问题。

 

 例子发上来。


--  作者:水青树叶
--  发布时间:2015/8/5 22:56:00
--  
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:目录树.zip


--  作者:大红袍
--  发布时间:2015/8/5 23:02:00
--  
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:目录树.zip


--  作者:水青树叶
--  发布时间:2015/8/5 23:17:00
--  
谢谢,问题已解决,可我还是看不明白是什么原因?
--  作者:大红袍
--  发布时间:2015/8/6 9:12:00
--  
把 nd.Name 改成了 nd.Text