Hi all,
I have a multiline textbox in which user enters some text and then I add those values in a combobox. Before adding to combo, I need to convert "Enter" key press with a single space. How can I convert "Enter" with a single space.
Thanks.
Printable View
Hi all,
I have a multiline textbox in which user enters some text and then I add those values in a combobox. Before adding to combo, I need to convert "Enter" key press with a single space. How can I convert "Enter" with a single space.
Thanks.
Search for \r\n (<enter> - new line) and replace that with a space.
Have a look at my answer in this post!
http://www.vbforums.com/showthread.p...21#post1855721
That code works, but this might be better for future proofing:
Code:string text = textBox5.Text;
text = text.Replace(System.Environment.NewLine," ");
textBox5.Text = text;