你不排序的话,就是按照输入顺序了,正确的代码应该是:
Dim tabmb As WinForm.TabControl = e.Form.Controls("TabControl1") Dim tr As WinForm.TreeView = e.Form.Controls("TreeView1") Dim nd As WinForm.TreeNode tables("产品类型基础资料1_Table1").fill("select * from tProductType","zmsteel",false) For Each dr as DataRow in tables("产品类型基础资料1_Table1").DataTable.Select("","fCode") If dr.IsNull("fParentCode") Then nd =tr.Nodes.Add("root1","" & dr("fCode") & " " & dr("fname") & "") else nd.Nodes.Add("Sub1"," " & dr("fCode") & " " & dr("fname") & " ") End If Next
|