Re: Loop through Multiple Line Textbox

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



LEC wrote:
> I would like some help on looping through a multipleline text box.

Take a look at the Split function. You can do something like this:

Dim lines As Variant, i As Long
lines = Split(Textbox1.Text, vbCrLf)
For i = 0 To UBound(lines)
' Do something here with each line
Next i

> have a textbox that is populated with dates. Let's say for example
> that the text box has 20 dates. I would like to put the first five
> dates in a document, then have a blank line, then the next five dates,
> then a blank line and then the next five, etc. Something like
> this....

To do something special every five, you can use a simple test (within the loop above)
like:

If (i + 1) Mod 5 = 0 Then
' spit out blank line, or whatever
End If

Later... Karl
--
Working Without a .NET?
http://classicvb.org/petition


.