I'm using the writeAlltext method to save a text file with the contents saved in string variable namely textFile1.

File.WriteAllText(saveFileDialog1.FileName, textFile1);

However for each blank line i'm getting two boxes in the output text file. I need to keep the formatting as it is while saving a file. the blank lines are being replaced by the boxes.

Any ideas?

What do you mean by boxes? Any nonprintable character is most often printed as a "box" character. I suspect linefeed and carriage return characters here.(ASCII 10 and 13, ASCII 65 is the 'A' character)

It's the line feed i guess i've to deal with. But how? How can I have a check on the ascii and even if i get's the line feed ascii how will I be able to represent it with a line feed in text file instead of nonprintable box char.

As I said, i'm using the File.WriteAllText method.

thx

What do you mean by boxes? Any nonprintable character is most often printed as a "box" character. I suspect linefeed and carriage return characters here.(ASCII 10 and 13, ASCII 65 is the 'A' character)

Please find the attached file to see the output text. There should be a line gap or a start of a new paragraph which is not the case. Rather the box char is being saved instead of a line feed while saving the contents to .txt file using File.WriteAllText method.

Change to multiline text boxes?

Attachments
Bad Credit? How To Apply For Personal Loans

Bad credit can make tough times tougher. Especially when an emergency arises and emergencies can happen to anyone. Whether it is a job loss, a medical emergency, or a car repair, at one time or another everyone needs a personal loan at sometime. 

So what can an individual with bad credit do when an emergency arises and they need a quick personal loan? Too often they've exhausted other resources such as family and friends and with a personal from somewhere the consequences to their family can be dire. 

What they need is an unsecured personal loan and they need it fast. The most popular and widely available unsecured personal loan is the payday loan. Payday lenders lend small amounts for a short period of time and don't require a credit check at all. But there are downsides to the payday loans. For one thing, the amounts are usually limited to under $500, secondly the interest rates are outrageous, ranging from 300% to 1500% as annual percentage rate.

Aside from the high interest rates, the other disadvantage of payday loans is the very short term of the loan. Often individuals who need a quick loan are living paycheck to paycheck before the emergency occurred. So on payday when the loan comes due, they renew the loan, and the interest keeps mounting. Recent publicity about the predatory lending practices of many payday lenders have encouraged more institutions to offer short-term loans

Credit unions were the first to rush in and offer short-term loans to their members. Other institutions, such as banks and savings and loans are beginning to offer these loans to their banking clients. There are several advantages to getting a loan from a credit union, bank or savings and loan. First, the interest rates they charge are far less than those offered by payday loan companies. Second, these institutions extend the repayment period from two weeks to usually around 90 days---making it far easier for the borrower to repay the loan without having to take out another loan. Finally, credit unions, banks and savings and loans limit the number of short-term loans their clients can get in a year.

Emergencies are stressful. They can be even more stressful if the individual has bad credit. The most important thing for individuals with bad credit to remember is that often there is more than one choice for a quick personal loan.

Very common mistake for who works with files, that they don't replace \n with \r\n
your text in textbox.Text = "lmlmalma\n lmlmla" that's wrong to do that File.WriteAllText(saveFileDialog1.FileName, textFile1); rather File.WriteAllText(saveFileDialog1.FileName, textFile1.Replace("\n", "\r\n"));

Hm...strange

Can you see the difference b/w the two. The Personal Loan one is what I want and the output one is what i'm actually getting.

I hope you can notice the line spaces in the first one which i'm unable to produce in the output one.

I see no boxes or empty lines when I open Output.txt with NotePad.

Attachments
Bad Credit? How To Apply For Personal Loans

Bad credit can make tough times tougher. Especially when an emergency arises and emergencies can happen to anyone. Whether it is a job loss, a medical emergency, or a car repair, at one time or another everyone needs a personal loan at sometime. 

So what can an individual with bad credit do when an emergency arises and they need a quick personal loan? Too often they've exhausted other resources such as family and friends and with a personal from somewhere the consequences to their family can be dire. 

What they need is an unsecured personal loan and they need it fast. The most popular and widely available unsecured personal loan is the payday loan. Payday lenders lend small amounts for a short period of time and don't require a credit check at all. But there are downsides to the payday loans. For one thing, the amounts are usually limited to under $500, secondly the interest rates are outrageous, ranging from 300% to 1500% as annual percentage rate.

Aside from the high interest rates, the other disadvantage of payday loans is the very short term of the loan. Often individuals who need a quick loan are living paycheck to paycheck before the emergency occurred. So on payday when the loan comes due, they renew the loan, and the interest keeps mounting. Recent publicity about the predatory lending practices of many payday lenders have encouraged more institutions to offer short-term loans

Credit unions were the first to rush in and offer short-term loans to their members. Other institutions, such as banks and savings and loans are beginning to offer these loans to their banking clients. There are several advantages to getting a loan from a credit union, bank or savings and loan. First, the interest rates they charge are far less than those offered by payday loan companies. Second, these institutions extend the repayment period from two weeks to usually around 90 days---making it far easier for the borrower to repay the loan without having to take out another loan. Finally, credit unions, banks and savings and loans limit the number of short-term loans their clients can get in a year.

Emergencies are stressful. They can be even more stressful if the individual has bad credit. The most important thing for individuals with bad credit to remember is that often there is more than one choice for a quick personal loan.

Got it. Thanks man, it solved the problem :)
thx

Very common mistake for who works with files, that they don't replace \n with \r\n
your text in textbox.Text = "lmlmalma\n lmlmla" that's wrong to do that File.WriteAllText(saveFileDialog1.FileName, textFile1); rather File.WriteAllText(saveFileDialog1.FileName, textFile1.Replace("\n", "\r\n"));

This question has already been answered. Start a new discussion instead.