Valgte inString.. Here's how I've done:
Private Function InString(SourceLine As String, StartSource As String, EndSource As String)
Dim i As Long
Dim j As Long
Dim TempStr As String
i = Len(StartSource) + InStr(SourceLine, StartSource)
If i > Len(StartSource) Then
j = InStr(i + 1, SourceLine, EndSource)
If j Then
TempStr = Mid$(SourceLine, i + 1, j - i - 1)
InString = TempStr
End If
End If
End Function
Public Function OpenPrj()
Dim intTreePrjTal
CommonDialog1.FileName = ""
CommonDialog1.DialogTitle = "Open Project..."
CommonDialog1.Filter = "Webster Project Files|*.wpj"
CommonDialog1.ShowOpen
strPrjNavn = CommonDialog1.FileTitle
Set nodx = TreeView1.Nodes.Add("Prj", tvwChild, "Projekt" & intTreePrjTal, strPrjNavn)
Open CommonDialog1.FileName For Input As #1
Do Until EOF(1)
Line Input #1, strBuf
strFind = InString(vbCrLf & strBuf & vbCrLf, "[path", "[/path]")
strBuf = InString(vbCrLf & strBuf & vbCrLf, "[name", "[/name]")
Set nodx = TreeView1.Nodes.Add("Projekt" & intTreePrjTal, tvwChild, strFind, strBuf)
intTreePrjFilTal = intTreePrjFilTal + 1
Loop
Close 1
intTreePrjTal = intTreePrjTal + 1
End Function
hvis nogen skulle få brug for koden
..