In my program i have made a Module to get word under mouse in this way
'====================================================
Module Module1
Public Function GetWordUnderMouse(ByRef Rtf As System.Windows.Forms.RichTextBox, ByVal X As Integer, ByVal Y As Integer) As String
On Error Resume Next
Dim POINT As System.Drawing.Point = New System.Drawing.Point()
Dim Pos As Integer, i As Integer, lStart As Integer, lEnd As Integer
Dim lLen As Integer, sTxt As String, sChr As String
'
POINT.X = X
POINT.Y = Y
GetWordUnderMouse = vbNullString
'
With Rtf
lLen = Len(.Text)
sTxt = .Text
Pos = Rtf.GetCharIndexFromPosition(POINT)
If Pos > 0 Then
For i = Pos To 1 Step -1
sChr = Mid(sTxt, i, 1)
If sChr = " " Or sChr = Chr(13) Or i = 1 Then
'if the starting character is vbcrlf then
'we want to chop that off
If sChr = Chr(13) Then
lStart = (i + 2)
Else
lStart = i
End If
Exit For
End If
Next i
For i = Pos To lLen
If Mid(sTxt, i, 1) = " " Or Mid(sTxt, i, 1) = Chr(13) Or i = lLen Then
lEnd = i + 1
Exit For
End If
Next i
If lEnd >= lStart Then
GetWordUnderMouse = Trim(Mid(sTxt, lStart, lEnd - lStart))
End If
End If
End With
End Function
End Module
'====================================================
It works
also i need to underline the word which the mouse is on it.
if anybody know how to do this please reply me
here is the other part of the program (Form1)
'====================================================
Public Class Form1
Dim word As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
On Error Resume Next
'Populate richtext box with some text
Me.RichTextBox1.Text = "This example shows you how to get the word that is currently under the mouse pointer of this window and displays it in the text box below. Hover your mouse pointer over the window and you will see what i mean

End Sub
Private Sub RichTextBox1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles RichTextBox1.MouseClick
TextBox1.Text = word
End Sub
Private Sub RichTextBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles RichTextBox1.MouseMove
On Error Resume Next
word = GetWordUnderMouse(Me.RichTextBox1, e.X, e.Y)
If Not word = "" Then
RichTextBox1.Cursor = Cursors.Hand
Else
RichTextBox1.Cursor = Cursors.Default
End If
End Sub
End Class
'====================================================
thanks all
regards Chandana