In my database I have addresses in one line, comma separated. That way they can be as many lines as they want...
I
read from the database and put addresses in a textbox as you would like
to read them - on individual lines. I use a simple string substitution:
txtAddress.Text = Replace(cmbAddress.Text, ",", vbNewLine)
I'm having problems saving it back to the database with commas if the user modifies it. I tried variations on:
Replace(txtAddress.Text, vbNewLine, ",")
with vbCrLf or chr(13) isntead of vbNewLine with no success so far...
Anyone know how I can succesfully find my new line characters and replace them with commas
Thanks,
James

How can I replace the newline character with something else from a textbox?
Sarguna
Replace(txtAddress.Text, vbCrLf, ",")
Paul Bradley
Dim ws As StreamWriter = New StreamWriter(filename)
Dim str As String
str = TextBox1.Text
Replace(str, chr(13), "|")
ws.WriteLine(str)
ws.Close()
I have tried chr(13), vbNewLine, vbCrLf, environment.newline. Nothing is working. I also tried the unicode way Replace(str, 13, "|"c).
Any help would be great thanks.
Xelestial
have you tried:
Dim replacedString as String = txtAddress.Text
replacedString = replacedString.Replace(Environment.NewLine, ",")
SQLChamp
Luo Cao
str = replace(str, chr(13) & chr(10), "|")
I also found out that chr(10) is needed to replace the line feed
thanks for the help