Using line breaks in datasets

Aug 14 2010 1:00 PM
Hello, I would appreciate a little help with a program I'm making.  It's basically an address book, consisting of a listBox that displays the people's name's, and text boxes which display their info... all of those are databound to a dataset, which is loaded from a SQL Server database when the program is loaded, and saved to it when the program exits.  When creating the dataset, I add combined columns such as FullAddress which combines their address, city state and zip to be displayed together.  I would rather do it like this then have separate display fields i.e. a separate textbox for first, middle, and last name because sometimes the middle name won't be added and it would look funny.  But I need to keep all that info in its separate fields in the database for lookup purposes.  Anyways, my problem is that when combining those fields when creating my dataset, I try to add new line characters so my fields are displayed like this...

Address
City, State Zip

But instead the newline characters are not being read and it all merges together
AddressCity,StateZip

Here is my code for combining the data columns


DataRow row = m_tempData.Tables["People"].NewRow();
row["FullAddress"] = tbAddress.Text + "\n" + tbCity.Text + ", " + cmbState.Text + "\t" + tbZip.Text;

The tab characters aren't getting either encoded or displayed correctly either.  Is there another way for me to do this? I've looked all over and can't seem to find a solution, if anyone has any advice I would greatly appreciate it, I am stumped.

Thanks.
Nick

Answers (3)