Tree aufbauen
[Visual Basic] Private Sub LoadTreeView( _
ByVal oDS As DataSet, _
ByRef oTreeview As TreeView _
)
[Visual Basic] Private Sub LoadTreeView(ByVal oDS As DataSet, ByRef oTreeview As TreeView)
'Dim oTreeView As TreeView = New TreeView()
Dim oDataRow As DataRow
fnt_Strikeout = New System.Drawing.Font(oTreeview.Font.FontFamily, oTreeview.Font.Size, FontStyle.Strikeout)
fnt_normal = New System.Drawing.Font(oTreeview.Font.FontFamily, oTreeview.Font.Size, FontStyle.Regular)
For Each oDataRow In oDS.Tables(0).Rows
If Not oDataRow.IsNull("Parentid") Then
If oDataRow.Item("Parentid") = 0 Then
'If oDataRow.IsNull("Parentid") Then
Dim oNode As New TreeNode()
oNode.Text = oDataRow("Bezeichnung").ToString()
oNode.Tag = oDataRow("Servicekatalognr").ToString
oNode.SelectedImageIndex = 0
oNode.StateImageIndex = 0
oNode.ImageIndex = 0
If oDataRow("Aktiv") = False Then
oNode.NodeFont = fnt_Strikeout
End If
oTreeview.Nodes.Add(oNode)
RecursivelyLoadTree(oDataRow, oNode)
End If
End If
Next oDataRow
oDS.Dispose()
oDS = Nothing
End Sub
Plattformen: Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition