Results 1 to 10 of 10

Thread: [RESOLVED] Determining the End of line....

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    87

    Resolved [RESOLVED] Determining the End of line....

    I have a code here that selects a particular string inside a richtextbox

    Dim a As String
    Dim b As String
    Dim c As String

    a = TextBox1.Text
    b = InStr(TextBox2.Text, a)
    If b Then

    TextBox2.SelectionStart = b - 1
    TextBox2.SelectionLength = Len(a)
    c = textbox2.SelectedText
    Else
    MsgBox("No text Found!")
    End If

    My question is how can I tweak it into selecting the whole line of the rich text box?

    For instance I have 3 lines

    This is my first line
    Second one is much longer
    The Third one should be the longest

    then I searched the word "second", how can I select the whole second line? Because if you use the code above it only gets the word "second" but not the whole line

    Thanks in Advance and more powers!

    EDIT
    By the way, I tried doing TextBox2.SelectionLength = Len(a) + number however of course that works only if you know the exact number of characters, and that wouldnt work since the text generated can be random
    Last edited by zaborgmobius; May 3rd, 2013 at 02:58 AM. Reason: Additional Info

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