[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

=?Utf-8?B?cm9kY2hhcg==?=

2/21/2004 3:36:00 PM

I need to split a multiline textbox into separate lines. I tried parsing it using instr(vbcrlf,textbox1.text) in a loop to locate the end of each line but no success

Does anyone have a solution?
3 Answers

Rocky Moore

2/22/2004 5:40:00 AM

0

Have you tried the string "Split" method? It will build an array of all
lines.

--
Rocky Moore
www.RJSoft.com
www.HintsAndTips.com - Share your tips with the world!
~~~~~~~~~ Developer Tips Welcome! ~~~~~~~~~

"arby" <anonymous@discussions.microsoft.com> wrote in message
news:FB0ECADC-C1D6-4B16-8BD6-08D199B65A1F@microsoft.com...
> I need to split a multiline textbox into separate lines. I tried parsing
it using instr(vbcrlf,textbox1.text) in a loop to locate the end of each
line but no success.
>
> Does anyone have a solution?


Jos

2/23/2004 9:03:00 AM

0

arby wrote:
> I need to split a multiline textbox into separate lines. I tried
> parsing it using instr(vbcrlf,textbox1.text) in a loop to locate the
> end of each line but no success.
>
> Does anyone have a solution?

You swapped the arguments for Instr.
Use:
InStr(textbox1.text, vbcrlf)

Anyway, Rocky's solution is better.

--

Jos


=?Utf-8?B?cm9kY2hhcg==?=

2/23/2004 2:21:00 PM

0

Thanks! The string.split method works great. I ended up using something like

strAnswers = Replace(txtAnswers.Text, vbLf, "").Split(vbCr

Since each line is actually split by 2 characters, 1 LF and 1 CR, this code snipet gives you very clean results (ie. no embedded LFs or empty array elements)