Hi guys
I hope someone can help , Am trying to populate a TreeView from a TXT file
My TXT file look like that :

[STANDARD_DATA 0]
STD_NAME=RED 1260418
BAT_DATETIME=1087475867,
BAT_NAME=BATCH
BAT_REFLPOINTS=35,
BAT_REFLINTERVAL=-10,
BAT_REFLLOW=360,
BAT_VIEWING=%T MAV SCI UV Inc
[BATCH_DATA 0]
STD_NAME=RED 1260418
BAT_DATETIME=1087475867,
BAT_NAME=BATCH
BAT_REFLPOINTS=35,
BAT_REFLINTERVAL=-10,
[BATCH_DATA 0]
STD_NAME=RED 1260418
BAT_DATETIME=1087475867,
and I would love to see my tree look like that
Filename
- STD 1
-- BAT 1
-- BAT 2
-STD 2
-- BAT 1
-- BAT 2
That mean I have look for STD1 ([STANDARD_DATA 0]) and then the BATCH as BAT and populate the tree
So what I have done so far is

TV.Nodes.Clear()
        Dim N As String = "[STANDARD_DATA"
        Dim Nstd As String = "STD"
        openfile.InitialDirectory = "C:\temp\"
        openfile.ShowDialog()


        Dim hoeveel As Integer = 0
        Dim level As Integer = 0
        Dim fileinhoud As New IO.StreamReader(openfile.FileName)
        While (fileinhoud.Peek > -1)
            If InStr(fileinhoud.ReadLine, N) Then
                level = level + 1
                TV.Nodes.Add(Nstd & level)
                MsgBox(level)
            End If
        End While

with this code i always mange to find my 1ste Nodes and i realy dont know how to the get the child

can anyone help plz?

try this:

TV.Nodes.Clear()
        Dim N As String = "[STANDARD_DATA"
        Dim Nstd As String = "STD"
        openfile.InitialDirectory = "C:\temp\"
        openfile.ShowDialog()


        Dim hoeveel As Integer = 0
        Dim level As Integer = 0
        Dim fileinhoud As New IO.StreamReader(openfile.FileName)

        Dim line As String
        Do
            line = fileinhoud.ReadLine()
            If line.StartsWith(N) Then
                level = level + 1
                TV.Nodes.Add(Nstd & level)
                MsgBox(level)
            End If
        Loop Until line Is Nothing
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.