Re: Writing listbox items into text file



"kimiraikkonen" <kimiraikkonen85@xxxxxxxxx> schrieb:
I can read from a text file and insert text file's contents into a
listbox whose format is line by line using this code:

Dim reader As String
reader = My.Computer.FileSystem.ReadAllText("c:
\bookmarks.txt")

Dim strs() As String
strs = Split(reader, Environment.NewLine)


For Each s As String In strs
ListBox1.Items.Add(s)
Next

=> 'ListBox1.Items.AddRange(strs)'.

But i also want to write all listbox items into text file "line by
line"? How can i do this?

I tried My.Computer.FileSystem.WriteAlltext but couldn't make out
completely.

Take a look at the 'Join' function.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
.



Relevant Pages

  • Writing listbox items into text file
    ... Dim reader As String ... Dim strs() As String ... But i also want to write all listbox items into text file "line by ...
    (microsoft.public.dotnet.languages.vb)
  • Re: code for formatting like custom cell formatting in excel
    ... part of the format to drop from the result. ... only strS is a dtring. ... the optional stuff to bring it all together in a string that i would then use ... False) As Variant ...
    (microsoft.public.access.formscoding)
  • Re: code for formatting like custom cell formatting in excel
    ... part of the format to drop from the result. ... only strS is a dtring. ... the optional stuff to bring it all together in a string that i would then use ... False) As Variant ...
    (microsoft.public.access.formscoding)
  • Reverse line reading order from text file into combobox
    ... I was working on a project that a combobox reads each line from a text ... Dim reader As String ... Dim strs() As String ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Strings in file
    ... but when i push the button i want to sort them in numbers?, ... string have more numbers after eachouther like this: ... var a, b: integer; begin ... Strs: TStringList; begin ...
    (alt.comp.lang.borland-delphi)

Loading