Record source from database not retaining its original string format. Why?

Hello experts,

There is a field in my mysql database that contains an email response. It is text only and it has spaces and paragraphs.

Problem:

Whenever I retrieve this record and output it to a textbox it changes from:

line1
line2

line3
line4

line5

line6
line7
line8

...to:

line1 line2 line3 line4 line5 line6 line7 line8

Can you perhaps show me where the following code is going wrong?






Imports MySql.Data.MySqlClient
Public Class frmMain
 
    Public Const connstr As String = "server=mysqlserver1;user id=User;password=Password;database=xyz"
 
    Dim arrResponse As New ArrayList
 
    Private Sub tbxSearch_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tbxSearch.TextChanged
 
        lbxResponses.Items.Clear()
 
        LoadRemoteVersion()
 
    End Sub
 
    Sub LoadRemoteVersion()
 
        Dim conn As New MySqlConnection()
 
        'Try
 
        conn.ConnectionString = connstr
        conn.Open()
 
        Dim myCommand As New MySqlCommand
        Dim myReader As MySqlDataReader
 
        myCommand.Connection = conn
        myCommand.CommandText = "SELECT * FROM archresponses WHERE responsetitle LIKE '%" & tbxSearch.Text & "%' OR responsetext LIKE '%" & tbxSearch.Text & "%'"
 
        myReader = myCommand.ExecuteReader
 
        Dim counter As Integer = 0
 
        While myReader.Read
 
            counter += 1
            lbxResponses.Items.Add(myReader.GetValue(1))
            arrResponse.Add(myReader.GetValue(2))
 
        End While
 
        lblTotalResults.Text = counter
 
        'Catch
 
        'End Try
 
        conn.Close()
        conn.Dispose()
 
    End Sub
 
 
    Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
 
    End Sub
 
    Private Sub lbxResponses_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lbxResponses.SelectedIndexChanged
 
        tbxResponse.Text = arrResponse(lbxResponses.SelectedIndex)
 
    End Sub
End Class

Open in new window

LVL 1
donniedarko801Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CodeCruiserCommented:
It is because a text box can not display formatting. Try setting the multiline property to true to be able to show line breaks. Or else use a RichTextBox control.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
donniedarko801Author Commented:
You know, my only regret is to only give you 50 points for this. Thanks man! Whish I had more points!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.