Remove Lines from TextBox

  • Thread starter Thread starter Becker
  • Start date Start date
B

Becker

This is probably a very dumb question, I am using VB.NET 2003 and I see
where I can use a method to append text to a textbox, but how about remove?
I have a textbox that I continually post log type data to and I want to keep
it limited to 500 lines of text so that old lines get removed. How can I
remove lines of text from a textbox?

Thanks,
Ben
 
Becker,

The textbox can hold lines and text.
When you use the appendtext you create just a string. So when you have to
shorten that you can use the substring for that
\\\
textbox1.text = textbox1.text.substring(whateverposition)
///
When you use lines you get something as this
\\\
TextBox1.Lines = New String() _
{"myfirststring", "mysecondstring", "mythirthString"}
Dim a As String() = TextBox1.Lines
Dim b(TextBox1.Lines.Length - 1) As String
TextBox1.Clear()
For i As Integer = 1 To a.Length - 1
b(i - 1) = a(i)
Next
TextBox1.Lines = b
///

I hope this helps?

Cor
 
Back
Top