Click here to Skip to main content
13,445,479 members (35,593 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Can someone give me a sample of the right way the parse a textbox with mutilpe lines of
data and send that data into named text boxes ?

I don't want anyone to do all the work ... just get me going the right way ..

I have:

City, State, zipcode

I want to send it to:
txtName, txtAddress, txtCity, txtState, txtZipcode & txtPhone

If someone will get me started I think I can figure it out.
Posted 21-Feb-13 9:12am
ryanb31 21-Feb-13 15:34pm
How can it be parsed? Is the data delimited by something?
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Where is the info stored in a multiline Textbox?
Answer: in the Lines array: MSDN[^]

So, if you scan through each line in the array, you should find 4 lines which contain information - if you don't the problem gets larger, because you have to work out which lines you do have, and that gets complicated.

Is that enough for the moment?
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Not quite.

I have 6 pieces I need to seperate so I can jam the data into the
named fields. Using an array seems the more advanced way, wouldn't
simple parsing of each line looking for the data be easier?

I have no experience but as the data is formatted the same everytime in the
large textbox i.e.

City, State ZipCode

What reading I have tried to figure out says I should loop thru the
text, I know the 1st and 2nd lines are Name, Address, then the 3rd
line has to be parsed looking for the comma and then anything between
the comma and the numbers is the state and finally the last line is
always the phone. My issue is I don't know how to start the parsing
so I can test the results over and over until I get it right.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.180314.2 | Last Updated 21 Feb 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100