digitalsindh 0 Newbie Poster

How to Retrive/select or Get underlined/Formated Text on Click event from rich text box in vb.net...

it should be just like Hyperlink but programmed with click event on it, not for Web page but for local cause.

i have the coding but its only for single word, i need for multiple Formated/underlined words or Phrase Please,

 ' Getting the word under the mouse clicked loaction
    'If e.Button = MouseButtons.Left Then
    '    Dim CharIndex As Int32
    '    Dim StartPos As Int32
    '    Dim EndPos As Int32

    '    'location of mouse clicked
    '    CharIndex = txtInfo.GetCharIndexFromPosition(New Point(e.X, e.Y))
    '    'Locating the end point of the selections
    '    EndPos = txtInfo.Text.IndexOf(" ", CharIndex)
    '    'Locating the start point of the selection
    '    StartPos = txtInfo.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
    '    txtInfo.Select(StartPos, EndPos - StartPos)
    '    MsgBox(txtInfo.SelectedText)

    'End If

help. thanks
fahad