5 pts.
 Replacing this ListBox code with Treeview code in VBA
I am importing the Board file and loading the data into treeview directly(Busname as parent node and NetName as Child node with delimitor as ! and i have taken the (myArray(i), "!")(1)) as Bus name and (myArray(i), "!")(2)) as Netname. Simultaniously i am tracking the Duplicate Netnames Listedin a Listbox which is seperately created.Now I want remove the list Box,need to display the duplicates in treeview. Now I just want to display the duplicates in a treeview itself rather than in List View.I am sending the code to you,just replace this listbox code with treeview I spaced the ListBox code(7 Lines) and assigned with line Numbers for your identification.These 7 lines I want to change into Treeview code. NOTE:: Listbox= lstNetName Treeview=treeBusNode Script cannot run Until and Unless you have Board file Private Function GetNetNameAndFillTree() 'imgProcessing.Visible = True treeBusNode.Nodes.Clear Dim DuplicateNetName As Boolean Dim strNetName As String DuplicateNetName = False lstNetName.Clear FullFileName = ActiveWorkbook.Path & "" & "NetName.txt" Set objReport = New Report If CheckBox1.Value = False Then If Len(Dir(FullFileName)) > 0 Then Kill (FullFileName) End If strTemp = "cmd /c extracta " & Chr(34) & txtFilePath.Text & Chr(34) & " " & Chr(34) & ActiveWorkbook.Path & "" & "CommandTemplate.txt" & Chr(34) & " " & Chr(34) & ActiveWorkbook.Path & "" & "NetName.txt" & Chr(34) Temp = Shell(strTemp, vbHide) Application.Wait DateAdd("s", 5, Now) End If strFileContent = objReport.GetReport(ActiveWorkbook.Path & "" & "NetName.txt") myArray = Split(strFileContent, vbCrLf) myArrayLength = UBound(myArray) - LBound(myArray) + 1 strTemp = "" DuplicateNetName = False For i = 0 To myArrayLength - 1 Step 1 If myArray(i) <> "" And Mid(myArray(i), 1, 2) = "S!" Then strNetName = Split(myArray(i), "!")(1) If strTemp <> strNetName And strNetName <> "" Then 1 For j = 0 To lstNetName.ListCount - 1 2 If lstNetName.List(j) = strNetName Then 3 DuplicateNetName = True 4 End If 5 Next j 6 If DuplicateNetName = False Then 7 lstNetName.AddItem (Split(myArray(i), "!")(1)) treeBusNode.Nodes.Add Key:=CStr(Split(myArray(i), "!")(1)) & "_Key", Text:=CStr(Split(myArray(i), "!")(1)) UpdateTree (Split(myArray(i), "!")(1)) strTemp = Split(myArray(i), "!")(1) End If DuplicateNetName = False End If End If Next i 'imgProcessing.Visible = False End Function

Software/Hardware used:
ASKED: May 4, 2009  5:41 AM
UPDATED: May 4, 2009  1:05 PM

Answer Wiki:
Last Wiki Answer Submitted:  Be the first to answer this question.
All Answer Wiki Contributors:  Be the first to answer this question.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _