Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 3rd, 2005, 08:53 PM
Registered User
 
Join Date: May 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to retrieve last selected text line in text bo

 Hi folks,

How would I achive the following. In a text box I've got a number of comma delimited records, and I want to retrieve the last record based on the first delimited item.

For example, if I've got the following rows in the text box:

  aa,123,123,123
  bb,123,123,123
  cc,123,123,123
  aa,456,456,456
  bb,456,456,456
  aa,789,789,789
  cc,456,456,456

and the row I want to retrieve is the last 'aa' row (aa,789,789,789).

Any pointers?

(BTW if it makes any difference, this is using VB.NET in the Compact Framework)

Thanks,
Gareth
 
Old May 3rd, 2005, 09:17 PM
Registered User
 
Join Date: May 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Resolved - this did the trick:

Code:
   Private Function GetLineStartWith(ByVal txt As String) As String
        Dim arr(), ReqLine As String
        arr = Split(Me.txtStream.Text, ControlChars.CrLf)
        For i As Int32 = 0 To arr.Length - 1
            If arr(i).StartsWith(txt) Then ReqLine = arr(i)
        Next
        Return ReqLine
   End Function





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to get text of a particular cell of selected r jjkk BOOK: ASP.NET AJAX Programmer's Reference : with ASP.NET 2.0 or ASP.NET 3.5 ISBN: 978-0-470-10998-4 0 January 22nd, 2008 07:39 AM
Retrieve hidden text box value through xslt? Hannibal XSLT 1 January 29th, 2007 05:09 AM
how to retrieve text from server-side? hertendreef ASP.NET 2.0 Professional 4 June 17th, 2006 06:04 AM
Selected Text itHighway Javascript How-To 5 February 3rd, 2006 06:18 AM
is the text in text box selected? nerssi Javascript 4 September 21st, 2004 09:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.