dim trv as winform.treeview=e.form.controls("tv1") dim nd as winform.treenode=trv.selectednode dim pnd as winform.treenode=trv.selectednode.ParentNode dim ppnd as winform.treenode=trv.selectednode.ParentNode.ParentNode Dim txt As WinForm.TextBox = e.Form.Controls("TB1") dim dr as datarow Dim Value As Integer=trv.selectednode.Level Select Case Value Case 0 dr=datatables("jg").find("sheng = '" & txt.value & "'") if dr is nothing then dr=datatables("jg").addnew() dr("sheng") = txt.value trv.nodes.add(txt.value,txt.value) end if Case 1 if nd is nothing then return end if dr=datatables("jg").find("xian= '" & nd.text & "' and xian= '" & txt.value & "'") if dr is nothing then dr=datatables("jg").addnew() dr("sheng")=pnd.text dr("xian")=txt.value nd.nodes.add(txt.value,txt.value) end if case 2 if nd is nothing then return end if dr=datatables("jg").find("xiang= '" & nd.text & "' and xiang= '" & txt.value & "'") if dr is nothing then dr=datatables("jg").addnew() dr("sheng")=ppnd.text dr("xian")=pnd.text dr("xiang")=txt.value nd.nodes.add(txt.value,txt.value) end if End Select
上述代码如果不删除"dim ppnd as winform.treenode=trv.selectednode.ParentNode.ParentNode"代码,则不同增加省份,如果删除就可以增加省份,是什么原因?
|