以下内容为程序代码:
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