Use these line of codes at mouse down event of richtextbox.
Private Sub rtbInput_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles rtbInput.MouseDown
' Getting the word under the mouse clicked loaction If e.Button = MouseButtons.Right Then Dim CharIndex As Int32 Dim StartPos As Int32 Dim EndPos As Int32
'location of mouse clicked CharIndex = rtbInput.GetCharIndexFromPosition(New Point(e.X, e.Y)) 'Locating the end point of the selections EndPos = rtbInput.Text.IndexOf(" ", CharIndex) 'Locating the start point of the selection StartPos = rtbInput.Text.LastIndexOf(" ", CharIndex)
'Checking if the mouse clicked on word If EndPos = -1 Then EndPos = 0 End If If StartPos = -1 Then StartPos = 0 End If If StartPos > EndPos Then Exit Sub End If 'selecting the word under the clicked location CharIndex -= StartPos rtbInput.Select(StartPos, EndPos - StartPos) End If End Sub