Results 1 to 5 of 5

Thread: Get Line in richtextbox1

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2008
    Posts
    297

    Get Line in richtextbox1

    ok I was wondering if its possible to get the line were setLSBCookie( is at . This is my code but didnt work out

    vb.net Code:
    1. i = RichTextBox1.Lines.IndexOf("setLSBCookie(")

    This is my error:

    Overload resolution failed because no accessible 'IndexOf' accepts this number of arguments.

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: Get Line in richtextbox1

    does it startwith "setLSBCookie(" or contain "setLSBCookie(" ?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2008
    Posts
    297

    Re: Get Line in richtextbox1

    Quote Originally Posted by .paul. View Post
    does it startwith "setLSBCookie(" or contain "setLSBCookie(" ?

    Starts with "setLSBCookie("

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: Get Line in richtextbox1

    try this:

    vb Code:
    1. dim index = (from line in RichTextBox1.Lines _
    2.                 where line.startswith("setLSBCookie(") _
    3.                 select RichTextBox1.Lines.IndexOf(line)).toarray
    4.  
    5. msgbox(index(0))

  5. #5
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: Get Line in richtextbox1

    sorry, my mistake. it should be:

    vb.net Code:
    1. Dim index = (From line In RichTextBox1.Lines _
    2.                  Where line.StartsWith("setLSBCookie(") _
    3.                  Select Array.IndexOf(RichTextBox1.Lines, line)).ToArray
    4.  
    5. MsgBox(index(0))

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