Results 1 to 4 of 4

Thread: [RESOLVED] [2005] Get The text of a line RTB

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2005
    Posts
    35

    Resolved [RESOLVED] [2005] Get The text of a line RTB

    how do i get the text of the line in wich the Caret is on in a richtextbox?
    I found this is how to get the index of the first chr but i am stuck there on.. RichTextBox1.GetFirstCharIndexOfCurrentLine

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Get The text of a line RTB

    vb.net Code:
    1. MessageBox.Show(myRTB.Lines(myRTB.GetLineFromCharIndex(myRTB.SelectionStart))))
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2005
    Posts
    35

    Re: [2005] Get The text of a line RTB

    O i see it has a built in lines option. I was looking for somthing like line.
    Thanks

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [RESOLVED] [2005] Get The text of a line RTB

    Just note that you want to avoid using the Lines property repeatedly if you can. Each time you access the Lines property it returns a new string array, so if you intend to use it more than once in quick succession you should only access the property once and assign its value to a local variable. You then use that variable repeatedly and thus only one string array is created. You only need to access the property value again if there's a chance that the Text has changed in between.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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