扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:佚名 来源:DotNET中文技术网 2007年10月25日
关键字: Windows
Private Sub TreeView1_SelectedIndexChange(ByVal sender As Object, ByVal e As Microsoft.Web.UI.WebControls.TreeViewSelectEventArgs) Handles TreeView1.SelectedIndexChange Dim dv As New DataView() dv.Table = ds.Tables("tree") Dim tmpNd As TreeNode = TreeNdSel(e.OldNode), tmpNds As TreeNodeCollection dv.RowFilter= "NODEID=" & tmpNd.ID dv(0)("NODE_DESCRIPT") = Me.TextBox1.Text dv(0)("ADDRESS") = Me.TextBox2.Text dv(0)("TARGET") = Me.TextBox3.Text dv(0)("ICON") = Me.TextBox4.Text If dv(0)("PARENTID").ToString <> Me.DropDownList1.SelectedItem.Value Then ‘移动节点 dv(0)("PARENT_NAME") = Me.DropDownList1.SelectedItem.Value If Me.DropDownList1.SelectedItem.Value = "ROOT" Then tmpNds = TreeView1.Nodes Else tmpNds = FromIdToNode(Me.DropDownList1.SelectedItem.Value, TreeView1.Nodes).Nodes’新的父节点的Nodes集合 End If GetNdCol(e.OldNode).Remove(tmpNd) tmpNds.Add(tmpNd) End If tmpNd.Text = Me.TextBox1.Text tmpNd.ImageUrl = Me.TextBox4.Text tmpNd = TreeView1.GetNodeFromIndex(TreeView1.SelectedNodeIndex) dv.RowFilter= "NODEID=" & tmpNd.ID Me.TextBox1.Text = dv(0)("NODENAME").ToString Me.TextBox2.Text = dv(0)("ADDRESS").ToString Me.TextBox3.Text = dv(0)("TARGET").ToString Me.TextBox4.Text = dv(0)("ICON").ToString End Sub Private Function FromIdToNode(ByVal ID As String, ByVal Nds As TreeNodeCollection) As TreeNode ‘由关键字查找节点 Dim i As Integer Dim tmpNd As TreeNode, tmpNd1 As TreeNode For Each tmpNd In Nds If tmpNd.ID = ID Then Return tmpNd Exit Function End If tmpNd1 = FromIdToNode(ID, tmpNd.Nodes) If Not (tmpNd1 Is Nothing) Then Return tmpNd1 Exit Function End If Next Return Nothing End Function |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者