Results 1 to 3 of 3

Thread: copy highlighted richtextbox text to clipboard vb.net

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2011
    Posts
    137

    Smile copy highlighted richtextbox text to clipboard vb.net

    I'm from Lithuania so do not surprize if you see program in LT version

    Hi i have only ths code for so far so maby someone will know
    how to copy only highlighted text like in the picature shown

    Exaple: what i want to copy like so

    www.blabla.com/2013
    www.ggg.com/2013 and so on to clipboard and other leave as it is not to copy.

    Name:  584e450a9827768b0fb5b5214e43dc8d.png
Views: 4088
Size:  71.7 KB

    Here is what i have for so far
    It copies only one selected text.
    But i want to copy to clipboard only highlighted like in the picture shown

    Code:
     If RichTextBox1.SelectedText <> "" Then
                'Copy the information to the clipboard
                Clipboard.SetText(RichTextBox1.SelectedText)
            Else
                'If no text was selected, print out an error message box
                MsgBox("No text is selected to copy")
            End If
    and this copy all but not in new line

    Code:
     If True Then
                ' Check if selection exists and that it's not null
                If RichTextBox1.SelectionLength > 0 Then
                    ' Copy the selected text to the Clipboard
                    Clipboard.SetText(RichTextBox1.Text, TextDataFormat.Text)
                End If
            End If
    Last edited by polas; Oct 25th, 2012 at 09:37 AM.

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: copy highlighted richtextbox text to clipboard vb.net

    Multiple selection is not possible in a RichTextBox so you've lost me!
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2011
    Posts
    137

    Re: copy highlighted richtextbox text to clipboard vb.net

    Ok if it is inpossible as you say so maybe you will know how to add highlighted from richtextbox to textbox or listbox from listbox to textbox all selected
    I just wanna add only matches not all

Tags for this Thread

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