473,406 Members | 2,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Remove Lines from TextBox

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
Nov 21 '05 #1
2 9502
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

"Becker" <be*@benbecker.net>
...
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

Nov 21 '05 #2
Thank you, I think this now makes sense to me.

Ben

"Cor Ligthert" <no************@planet.nl> wrote in message
news:uM*************@TK2MSFTNGP10.phx.gbl...
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

"Becker" <be*@benbecker.net>
..
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


Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: a | last post by:
I'm trying to remove specific lines from text files. I need to always remove lines 1 thru 8 and lines 10 and 11 from text files. Seems like a simple task, but I'm not getting it. I'm reading...
0
by: Dot net work | last post by:
Hi, Make up a very simple project as follows: 1 aspx form 3 web user controls (referred to as A, B, and C) "A" web user control: Put 1 textbox and 1 button on this web user control. (You...
1
by: Benny Raymond | last post by:
I have lines of data coming from a server being written to a RichTextBox... The problem is that if I let this program run for a long period of time there are hundreds of lines of text showing up in...
2
by: Quentin | last post by:
I have a text file with lines that I would like to remove above a certain word and below another word. Example: 1231231231234123423434 2341234123412341242141 234512353764316236234...
1
by: Quentin | last post by:
First off, I would like to thank those who have given me help so far! I would like to remove all the lines of data above the word Recipe in a text file and all the lines below the words "End of...
8
by: Umesh | last post by:
Please help. THANKS.
2
by: jonathan184 | last post by:
How to exclude lines from a txt file that start with a # Hi basically my script works fine. I wanted to add some comments in my config file but it is reading in the comment lines to. So...
3
by: Barkingmadscot | last post by:
I am stuck, i can workout how to remove lines from an array I have loading a text file (a Log), I know which lines a need, but the logs can be upto 30K sometimes bigger. I found trying to...
2
by: lilly07 | last post by:
Hi, I have a 10 million record in a tab delimited text file (data.txt) and I have another file with line numbers (line_num.txt). My data.txt is as follows first 1 res 234 sec 23 fre 890...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.