473,662 Members | 2,390 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Re adLine
stringBuilder.A ppend("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
5 3430
Remove the new-line char before appending.

"rodchar" <ro*****@discus sions.microsoft .comwrote in message
news:3F******** *************** ***********@mic rosoft.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.Re adLine
stringBuilder.A ppend("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
Sorry, ignore my reply.

"Siva M" <sh******@onlin e.excite.comwro te in message
news:OG******** ******@TK2MSFTN GP02.phx.gbl...
Remove the new-line char before appending.

"rodchar" <ro*****@discus sions.microsoft .comwrote in message
news:3F******** *************** ***********@mic rosoft.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.Re adLine
stringBuilder.A ppend("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
Howdy,
Dim reader As StreamReader = File.OpenText(p athToMyFile)
Dim line As String = reader.ReadLine ()
Dim builder As New System.Text.Str ingBuilder()
Do Until line Is Nothing

builder.Append( "my value")
builder.Append( line)

line = reader.ReadLine ()

Loop
TextBox1.Text = builder.ToStrin g()

--
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.Re adLine
stringBuilder.A ppend("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
thanks for the help. rod.

"Milosz Skalecki" wrote:
Howdy,
Dim reader As StreamReader = File.OpenText(p athToMyFile)
Dim line As String = reader.ReadLine ()
Dim builder As New System.Text.Str ingBuilder()
Do Until line Is Nothing

builder.Append( "my value")
builder.Append( line)

line = reader.ReadLine ()

Loop
TextBox1.Text = builder.ToStrin g()

--
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.Re adLine
stringBuilder.A ppend("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
Np, You're welcome
--
Milosz Skalecki
MCAD
"rodchar" wrote:
thanks for the help. rod.

"Milosz Skalecki" wrote:
Howdy,
Dim reader As StreamReader = File.OpenText(p athToMyFile)
Dim line As String = reader.ReadLine ()
Dim builder As New System.Text.Str ingBuilder()
Do Until line Is Nothing

builder.Append( "my value")
builder.Append( line)

line = reader.ReadLine ()

Loop
TextBox1.Text = builder.ToStrin g()

--
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.Re adLine
stringBuilder.A ppend("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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
5678
by: Martin Dieringer | last post by:
I am trying to split a file by a fixed string. The file is too large to just read it into a string and split this. I could probably use a lexer but there maybe anything more simple? thanks m.
5
12228
by: Andy Mee | last post by:
Hello one and all, I'm developing an Asp.NET system to take a CSV file uploaded via the web, parse it, and insert the values into an SQL database. My sticking point comes when I try to split() the string returned by readline() on the file. The following code snippet works for me: tokens = "one,two,three,four".Split(",") for each token in tokens response.write("<td>"+token+"</td>")
2
1702
by: zjut | last post by:
want to add a string to the file and the file is sort by letter! for examply: the follow file is a big file! ////////////////////// abort black cabbage dog egg fly ////////////////////
3
3091
by: Mahmood Ahmad | last post by:
Hi, I am getting the error 'Input String was not in correct format' in the following C# program (indicated line): using System; namespace CF7 { class CalcArea {
18
2158
by: ILCSP | last post by:
Hi, I just started learning Visual Basic (VB.NET 03) and I need to do this small program that will read a text file we get from another company that has survey data, parse it and flatten it out and make single strings out of the records in it. The major difference between this space delimited file from the many examples in these groups is that the data is not presented horizontally, but vertically. You can see an example below. What I...
8
2353
by: Richard Schulman | last post by:
The following program fragment works correctly with an ascii input file. But the file I actually want to process is Unicode (utf-16 encoding). The file must be Unicode rather than ASCII or Latin-1 because it contains mixed Chinese and English characters. When I run the program below I get an attribute_count of zero, which is incorrect for the input file, which should give a value of fifteen or sixteen. In other words, the count...
4
23031
by: moondaddy | last post by:
I need to edit the text in many files so I'm writing a small routine to do this. First I have a method that loops through all the files in a directory and passes the full file path to another method (ReadFile). I'm going to use this to edit the file paths in all of my WMP play lists. When I run this the string variable is not being changed using the replace method. Here's what I have: Private Sub ReadFile(ByVal path As String)
4
10865
by: =?Utf-8?B?c2FtMDFt?= | last post by:
just as the subject states, I need to find a way to read each line from a multiline variable without having to write the string out to a file so I can stream it in and use ReadLine(). Below is a snippet of code where I am trying to read the string that has been passed into the function. //source is the string of data to parse out //nodes is the Xml Node Name in the mappingFile ("/Meters/Ion/Report/Field") //ReadLine indicates whether...
4
2023
by: dacuteangel04 | last post by:
ok what my program is suppost to do is open a file - Grades.txt and read each line the breaking the lines down w/ tokens so i may later average some numbers an example some of the lines from the text is: 234-42-1111 90 80 23 67 214-77-2222 12 45 80 112-45-7689 99 82 71 45 it has a id number on the left and grades on the right.
0
8432
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8856
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8762
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6185
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1992
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.