何らかの理由でスタックしていて、ツリーのフォレストが見えません。TreeNodeクラスを使用すると、TreeViewなしで階層構造のデータを扱うことができます。
- ユニークID子どもの
- 親
- 一覧: は、私は非常に単純現時点では、データ(約6000ノード)の大規模なリストを持っている:私は何をしたいか
- リスト項目
現在のところ、これはフラットなデータですが、私はそれの階層を作成したいので、私はできツリー任意のIDについて
- 検索単一ID
- (水平、垂直)エントリ
- 順序水平アイテムをループ
- リストアイテム
私が試した何: 私はこのコードを開始しました: see link
<Serializable> _
Public Class TreeNode
Private _uniqueID As Integer
Private _name As String
Private _parentID As Integer
Private _depth As Integer
Private _children As ArrayList
Public Sub New()
End Sub
Public Sub New(name As String, parentID As Integer)
Me.New(0, name, parentID, -1)
End Sub
Public Sub New(uniqueID As Integer, name As String, parentID As Integer, depth As Integer)
_uniqueID = uniqueID
_name = name
_parentID = parentID
_depth = depth
End Sub
''' <summary>
''' Gets or sets the unique ID associated with this category
''' </summary>
''' <remarks>Once a non-zero ID has been set, it may not be modified.</remarks>
Public Property UniqueID() As Integer
Get
Return _uniqueID
End Get
Set
If _uniqueID = 0 Then
_uniqueID = value
Else
Throw New Exception("The UniqueID property cannot be modified once it has a non-zero value")
End If
End Set
End Property
Public ReadOnly Property Depth() As Integer
Get
Return _depth
End Get
End Property
''' <summary>
''' Gets or sets the label for this node
''' </summary>
Public Property Name() As String
Get
Return _name
End Get
Set
_name = value
End Set
End Property
''' <summary>
''' The ID of the parent node
''' </summary>
Public Property ParentID() As Integer
Get
Return _parentID
End Get
Set
_parentID = value
End Set
End Property
''' <summary>
''' Gets the children TreeNode objects for this category
''' </summary>
''' <remarks>In .NET 2.0, this can be modified to use generics, and have type ArrayList<TreeNode></remarks>
Public Property Children() As ArrayList
Get
Return _children
End Get
Set
_children = value
End Set
End Property
End Class
私は私のツリーを作成しました:
Public Dendrogram As List(Of TreeNode)
...と、それにすべてのノードを追加しました。超清潔で分かりやすい、機能はありません!
これは私にanother approachをもたらしました。しかし、それは私の目的にとってはあまりにも複雑です。
..私はMSのTreeNodeクラスを使用してみませんか?しかし、私はそれに関連付けられているTreeViewを使用する必要はありません。 thisの例がありますが、それはC言語であり、VBNetには適用できないようです(ITreeNodeの実装に固執しました)。
私の質問: はどのように私は実際にはなく、そのような "treeView1.Nodes.Add(topNode)" または "treeView1.Nodes(0).Nodes.Find(検索語、トゥルー)" のようにツリービューの機能を使用することができます私のフォーム上に持っています(データを視覚化せずにデータを整えるだけです)。
これは意味があり、誰もが正しい方向に私を指すことができることを願っています!
これは絶対マーク、働いていました!あなたの詳細な答え、そして私の遅い応答のための多くのお詫びをありがとう! – Alex