|
-
Mar 20th, 2006, 01:29 PM
#1
Thread Starter
Lively Member
Parsing text
I have a form that has a textbox where I want users to copy a pre-defined template into. The template will look something like this:
First Name: Bla
Last Name: Bla-Bla
Email: [email protected]
and so on. What I want to do is then read through this text line by line and put each description into seperate variables. How do I accomplish this?
Thanks in advance for any help.
"A candle loses nothing by lighting another candle."
-
Mar 20th, 2006, 01:30 PM
#2
Re: Parsing text
Why dont you just have them enter the text into three seperate textboxes?? Saves you from having to parse it out, as each one would be in its own textbox...
-
Mar 20th, 2006, 06:54 PM
#3
Re: Parsing text
As Gig suggests, seperate controls is more appropriate. You should use three Labels and three TextBoxes. It would then be easy to validate the format of the e-mail address using a Regex as well. If you are determined to use a single TextBox then you would use the Lines property, which is an array of strings that is basically the Text split on line breaks.
-
Mar 21st, 2006, 08:48 AM
#4
Thread Starter
Lively Member
Re: Parsing text
Can you give me an example of how I would use the lines feature to accoplish this?
As far as the individual text boxs that will come later this is something for a type of automation.
Thanks
"A candle loses nothing by lighting another candle."
-
Mar 21st, 2006, 01:10 PM
#5
Re: Parsing text
The lines is just a property of the textbox... it is a string array... you just refer to the index of the line you want... like below:
VB Code:
MessageBox.Show(TextBox1.Lines(0))
MessageBox.Show(TextBox1.Lines(1))
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|