On Oct 31, 11:56 am, kimiraikkonen <kimiraikkone...@gmail.com> wrote:
> On Oct 30, 11:50 pm, "Herfried K. Wagner [MVP]" <hirf-spam-me-
>
>
>
> h...@gmx.at> wrote:
> > "kimiraikkonen" <kimiraikkone...@gmail.com> schrieb:
>
> > > I want to save all the item content of a listbox line by line into a
> > > simple text file then recall them when my project is opened.
>
> > > For example listbox1 contains:
>
> > > That - item1
> > > Group -item2
> > > Is -item3
> > > Really -item4
> > > Good -item5
>
> > > And the text file must be 1:1 same then i have to load/syncronize
> > > textfile to listbox when the project is opened.
>
> > > Should i use streamreader/writer or is there another flexible class
> > > that helps?
>
> > 'My.Computer.FileSystem.ReadAllText', 'My.Computer.FileSystem.WriteAllText',
> > 'Split', 'Join'.
>
> > --
> > M S Herfried K. Wagner
> > M V P <URL:http://dotnet.mvps.org/>
> > V B <URL:http://dotnet.mvps.org/dotnet/faqs/>- Hide quoted text -
>
> > - Show quoted text -
>
> Very thanks but i want to display them in a listbox line by line.
>
> Dim reader As String
> reader = My.Computer.FileSystem.ReadAllText("c:\test")
> ListBox1.Items.Add(reader)
>
> When i do that, ALL the text is displayed in the first line as
> combined. But the original "test.txt" file has items line by
> line(seperated with line break) as descibed in my previous message.
>
> Thanks in advance!
Read the text file line by line (reader.ReadLine() I believe) in a
loop and add the items that way.
Thanks,
Seth Rowe
|