Saturday, March 31, 2012

string.ReadLine

hey all,
i'm trying to read a text document line by line into a stringbuilder and an
issue i'm running into is this:
do while streamReader.ReadLine
stringBuilder.Append("my string" & string.ReadLine)
is showing up like this:
"my string"
value
instead of
"my string" value
how do i keep the value on the same line as my string?
thanks,
rodcharRemove the new-line char before appending.
"rodchar" <rodchar@.discussions.microsoft.com> wrote in message
news:3F4906CE-8C17-4026-83D7-974DEB940147@.microsoft.com...
hey all,
i'm trying to read a text document line by line into a stringbuilder and an
issue i'm running into is this:
do while streamReader.ReadLine
stringBuilder.Append("my string" & string.ReadLine)
is showing up like this:
"my string"
value
instead of
"my string" value
how do i keep the value on the same line as my string?
thanks,
rodchar
Sorry, ignore my reply.
"Siva M" <shiva_sm@.online.excite.com> wrote in message
news:OGy8ypG$GHA.4464@.TK2MSFTNGP02.phx.gbl...
Remove the new-line char before appending.
"rodchar" <rodchar@.discussions.microsoft.com> wrote in message
news:3F4906CE-8C17-4026-83D7-974DEB940147@.microsoft.com...
hey all,
i'm trying to read a text document line by line into a stringbuilder and an
issue i'm running into is this:
do while streamReader.ReadLine
stringBuilder.Append("my string" & string.ReadLine)
is showing up like this:
"my string"
value
instead of
"my string" value
how do i keep the value on the same line as my string?
thanks,
rodchar
Howdy,
Dim reader As StreamReader = File.OpenText(pathToMyFile)
Dim line As String = reader.ReadLine()
Dim builder As New System.Text.StringBuilder()
Do Until line Is Nothing
builder.Append("my value")
builder.Append(line)
line = reader.ReadLine()
Loop
TextBox1.Text = builder.ToString()
Milosz Skalecki
MCAD
"rodchar" wrote:

> hey all,
> i'm trying to read a text document line by line into a stringbuilder and a
n
> issue i'm running into is this:
> do while streamReader.ReadLine
> stringBuilder.Append("my string" & string.ReadLine)
> is showing up like this:
> "my string"
> value
> instead of
> "my string" value
> how do i keep the value on the same line as my string?
> thanks,
> rodchar
thanks for the help. rod.
"Milosz Skalecki" wrote:
> Howdy,
>
> Dim reader As StreamReader = File.OpenText(pathToMyFile)
> Dim line As String = reader.ReadLine()
> Dim builder As New System.Text.StringBuilder()
>
> Do Until line Is Nothing
> builder.Append("my value")
> builder.Append(line)
> line = reader.ReadLine()
> Loop
>
> TextBox1.Text = builder.ToString()
> --
> Milosz Skalecki
> MCAD
>
> "rodchar" wrote:
>

0 comments:

Post a Comment