text file question

I love vb

New member
Joined
Nov 1, 2011
Messages
3
Programming Experience
1-3
Hello vbdotnetforums users


Right i need to be able to read a text file up to a certain point or from a certain point EG..


textfile :


asd
sdfklg
adsfkgjddgjfg
####
adsfadsfasdf
adsfasdfasdf


i would like to be able read from the line (####) or up to that line (####)


why ?


as its like a save file were from a certain point in this
text file its going to list the text into a text box but before that point it going to list into a list box Eg..


asd <---- list box item
sdfklg <---- list box item
adsfkgjddgjfg <---- list box item
#### <---- the point of change
adsfadsfasdf <---- text box text
adsfasdfasdf <---- text box text


btw.. as its a save file type thing the text is not going to
be the same as above that just to get my point
across to you but the "point of change" (####)
will be the same :beguiled: and thanks for reading :beguiled:
 
Read the whole file in a string collection:

VB.NET:
Dim numIt As Integer
For Each line As String In File.ReadLines("d:\data\episodes.txt")
    numIt += numIt
    If Not line.Contains("####") Then
        Listbox1.Items.Add(line)
    Else
        Listbox1.Items.Add("Read up to Marker " & numIt & "!")
    End If
Next line

For your use though, why not use the already available app.config files?
 
Back
Top