English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Hi,
Does anyone know how I may Traverse all the nodes in a treeview using VC++.NET. Any code wud be great

2006-07-21 09:20:50 · 1 answers · asked by kannappadysrinidhi 1 in Computers & Internet Programming & Design

1 answers

To prevent the user from thinking its machine has locked up, progress bar to show that the nodes are being loaded. For generality, created a form with a Label and a ProgressBar on it,

Anyway, here's the code, any advice?

Private Sub LoadNonItemedFacilities(ByRef aNode As TreeViewEx.vb.TreeViewEx.TreeNode)
Dim drarray() As Data.DataRow
Dim dr As Data.DataRow
Dim filter As String = "Items Is Null"
Dim sort As String = "FDEPFacilityID"
Dim fac As Facility
Dim ndNew As TreeViewEx.vb.TreeViewEx.TreeNode
Dim cnt As Integer = 1
Dim recCount As Integer
Dim prg As frmProgress

drarray = dsFacilityInformation.tblFacility.Select(filter, sort, DataViewRowState.CurrentRows)
prg = New frmProgress
prg.Visible = True
prg.Text = "Populating Tree"
recCount = drarray.Length
prg.MaxValue = recCount
If Not drarray.Length = 0 Then
aNode.Nodes.Clear()
For Each dr In drarray
prg.Value = 100 * (cnt / recCount)
fac = New Facility(dr)
ndNew = New TreeViewEx.vb.TreeViewEx.TreeNode(fac.ToString)
ndNew.NodeKey = "fac" & fac.FDEPFacilityID
aNode.Nodes.Add(ndNew)
cnt = cnt + 1
Next
ndNew = New TreeViewEx.vb.TreeViewEx.TreeNode("")
ndNew.NodeKey = "fac"
aNode.Nodes.Add(ndNew)
End If
_nonItemedFacilitiesLoaded = True
prg.Close()

End Sub

2006-07-25 00:05:40 · answer #1 · answered by Joe_Young 6 · 0 0

fedest.com, questions and answers