Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 139
  • Last Modified:

Retrieve Lines From Textbox

How can I write a function to retrieve lines from  a text box? I need a function to which I can pass line number from the bottom ( 1 = last line, 2= seconds last line etc) and it returns the appropriate line.
0
sambha03
Asked:
sambha03
  • 2
1 Solution
 
EDDYKTCommented:
Try this


Private Function GetLine(ByVal LineNumber)
    Dim line

    line = Split(Text1.Text, vbCrLf)
    If (LineNumber <= UBound(line) + 1) Then
        GetLine = line(LineNumber - 1)
    End If
    erase line
End Function
0
 
EDDYKTCommented:
OOhs

Private Function GetLine(ByVal LineNumber)
   Dim line

   line = Split(Text1.Text, vbCrLf)
   If (LineNumber <= UBound(line) + 1) Then
       GetLine = line(ubound(line) - LineNumber)
   End If
   erase line
End Function
0
 
sambha03Author Commented:
Thanks.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now