Results 1 to 4 of 4

Thread: Get value of line

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2002
    Location
    Toronto, Ontario, Canada
    Posts
    275

    Get value of line

    Hey,

    I have a string, and I want to get the value of the first and second lines to 2 strings.

    Thanks!

  2. #2
    Lively Member
    Join Date
    Nov 2003
    Location
    Iowa
    Posts
    96
    Can you be more specific I dont understand what ur saying...
    It is like wiping your ass with silk, I love it!

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2002
    Location
    Toronto, Ontario, Canada
    Posts
    275
    like i have a string with 2 lines

    i want to get the value of the first and second line into to different strings

  4. #4
    Addicted Member
    Join Date
    Aug 2003
    Posts
    153
    First get the index of the line break. (vbCrLf)

    VB Code:
    1. Dim intIndex As Integer = myString.IndexOf(vbCrLf)

    Then get the substrings

    VB Code:
    1. Dim line1 As String = myString.Substring(0, intIndex)
    2. Dim line2 As String = myString.SubString(intIndex + 1, (myString.Length - 1) - intIndex)

    This code is untested so the index's, lengths may be a little off, but basically it's just a case of using a combination of index and substring methods.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width