473,651 Members | 3,063 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 9566
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.s ubstring(whatev erposition)
///
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.Line s.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******** *****@TK2MSFTNG P10.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.s ubstring(whatev erposition)
///
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.Line s.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
7687
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 the file via webresponse as a stream and then trying to remove the lines before parsing it and then writing it to an sql table. Any ideas on how I can accomplish the line removal/deletion?
0
1228
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 must do this exactly!)
1
5084
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 the RichTextBox.. How would I go about setting a buffer size that would remove old lines as new ones are being added? Also, how can I do this without removing the formatting in the box. (I tried to do some array manipulation and replace the...
2
2241
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 1235635326235125134534 Recipe
1
1675
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 Recipe" in this file. I want to keep everything inbetween these two lines. Below is a small sample of my text file and the code I have so far. 2,3,5,6,56,7,4,7,,,56,5,7, -1,45,4,451,7,66,7,667, "Recipe KX009.RCP, Date=02/11/07, Time=12:20:27,
8
4195
by: Umesh | last post by:
Please help. THANKS.
2
1947
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 basically i want to not read in the config lines in the script. This is the piece of the script that is reading in the lines in the array. Now it works fine without the if statement. So reason it is not working.
3
5586
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 delete the lines from the log file before loading in the array took ages, i thought i would be alot quicker to put in an array and remove the unwanted lines. Dim text As Array Dim lines As New List(Of String)
2
2815
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 dec 26 der 690 ...
0
8361
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8278
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8807
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7299
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5615
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4144
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2701
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1912
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1588
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.