Replacing this ListBox code with Treeview code in VBA

5 pts.
Tags:
Excel VBA
ListBox
Microsoft Excel 2003
TreeView
VBA
Visual Basic for Applications
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
ASKED: May 4, 2009  5:41 AM
UPDATED: May 4, 2009  1:05 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following