Avatar of brasso_42
brasso_42

asked on 

ASP.Net Count number of lines in a text box

Hi

I have a text box which displays the results of a ping.  I only want to display the last 10 results in the textbox though.

How can I count the number of lines in the text box and if there is more than 9 delete the top line using VB.

Many thanks
Microsoft SQL ServerASP.NETASP

Avatar of undefined
Last Comment
Shaun Kline
Avatar of Shaun Kline
Shaun Kline
Flag of United States of America image

The ping lines should have a line termination/new line character which you should be able to use along with the String.Substring and String.IndexOf methods. It would look something like:

<textbox value>.substring(<textbox value>.indexOf(Environment.NewLine)+2)

Open in new window


The +2 will "move" the cursor past the two characters that make up the NewLine/Line Feed characters.
ASKER CERTIFIED SOLUTION
Avatar of Shaun Kline
Shaun Kline
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Microsoft SQL Server
Microsoft SQL Server

Microsoft SQL Server is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.SQL Server is available in multiple versions, typically identified by release year, and versions are subdivided into editions to distinguish between product functionality. Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning.

171K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo