title: vb.net Writing & Reading Multiline Text in MySQL Database
body: <p>I'm trying to create a messaging system e.g. I have a table in a MySQL database called tbluser which holds the data for every user. One record is one user which has the field of 'StatusMessage'. This field can have values which can be written onto multiple lines, but I am having trouble on how to separate the text this field holds into multiple lines using a ListBox.</p>
  
  <pre class="lang-vb prettyprint-override"><code>Private Sub lstMessages_VisibleChanged(sender As Object, e As EventArgs) Handles lstMessages.VisibleChanged
      Dim Query As String = "SELECT StatusMessage FROM tbluser WHERE UserID=@userID"
  
      Using Conn As New MySqlConnection(MySQL.ConnectionDetails)
          Using Comm As New MySqlCommand()
              With Comm
                  .Connection = Conn
                  .CommandText = Query
                  .CommandType = CommandType.Text
                  .Parameters.AddWithValue("@userID", CInt(cboSelectUser.SelectedItem.ToString))
              End With
              Try
                  Conn.Open()
                  Dim Reader As MySqlDataReader = Comm.ExecuteReader
                  lstMessages.Items.Clear()
                  While Reader.Read OrElse (Reader.NextResult And Reader.Read)
                      lstMessages.Items.Add(Reader.GetString(0))
                  End While
              Catch ex As MySqlException
  
              End Try
          End Using
      End Using
  
  End Sub
  </code></pre>
  
  <p>At the moment, all the text appears onto one line.</p>
  
  <p>Also, another question, how would I insert text into the database with multiple lines.</p>