Hey.
How can i delete the last line in a text box.
Thanks
Sean
Printable View
Hey.
How can i delete the last line in a text box.
Thanks
Sean
go backwards through the string, once you hit a chr$(13), delete everything from that index forward...
Bleh?Quote:
Originally posted by nemaroller
go backwards through the string, once you hit a chr$(13), delete everything from that index forward...
Using the textbox's functions. It has a function to get how many lines there are within a textbox and then you can work from there.
I would give you code or somehting, but I'm on the wrong computer, if I'm on later and no one has helped you maybe I can throw something together :)
Yeah if you could when you get a chance that would be great!!.
Thanks
Sean
:D
I was unaware of the Lines member of the Textbox... obviously, that would be alot easier for lines under 5,000 long...
VB Code:
If TextBox1.Lines.Length > 0 Then Dim r(TextBox1.Lines.Length - 2) As String Array.Copy(TextBox1.Lines, r, r.Length) Array.Clear(TextBox1.Lines, 0, TextBox1.Lines.Length) TextBox1.Lines = r End If