By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,353 Members | 1,237 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,353 IT Pros & Developers. It's quick & easy.

string.ReadLine

P: n/a
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
Oct 30 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Remove the new-line char before appending.

"rodchar" <ro*****@discussions.microsoft.comwrote in message
news:3F**********************************@microsof t.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

Oct 30 '06 #2

P: n/a
Sorry, ignore my reply.

"Siva M" <sh******@online.excite.comwrote in message
news:OG**************@TK2MSFTNGP02.phx.gbl...
Remove the new-line char before appending.

"rodchar" <ro*****@discussions.microsoft.comwrote in message
news:3F**********************************@microsof t.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

Oct 30 '06 #3

P: n/a
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 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
Oct 30 '06 #4

P: n/a
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:
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
Oct 30 '06 #5

P: n/a
Np, You're welcome
--
Milosz Skalecki
MCAD
"rodchar" wrote:
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:
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
Oct 30 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.