By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,478 Members | 1,374 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,478 IT Pros & Developers. It's quick & easy.

Parsing user input from a textbox in vb.net

P: n/a
hello VB masters I have an issue that I am hoping you can help me with.
I am creating an application that accepts user input via a richtextbox.
the user can enter multiple entries and I need to parse the information
and account for whitespaces, newlines etc. I am hoping that the user
enters one per line but that is not always the case. the input would
look something like this

abc
def
hij

right now I am parsing the input with a regex and splitting it into a
string array but I do not know how to account for the carrige returns
in the richtextbox. Here is the line I am using to gather the user
input.

Dim myArray As String() = Regex.Replace(Trim(TestAcctWin.Text),
"\s+|\s", "|").Split("|")

this successfully parses everything I need but I get two empty elements
in the array depending if the user enters a carrige return on a line by
its self. how do I replace the carrige returns in a richtextbox with
spaces? I have tried replacing \n\r and \r\n and have not been
successful. if I could replace the carriges with spaces before my split
line then I believe it will work.

thanks!

Feb 3 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.