yes you would have to setup error checking for the values...ie if the search string is not found it returns negative 1...now if you are saying that you don't know what the urls are in the rtb then you have some serious parsing of the richtext to do to find the potential hyperlinks
Private Sub RichTextBox1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles RichTextBox1.MouseUp
Dim TheUrl As String = "www.TheUrl.Com"
Dim StartIndexOfLink As Integer = Me.RichTextBox1.Find(TheUrl)
Dim EndIndexOfLink As Integer = StartIndexOfLink + TheUrl.Length
Dim ClickedIndex As Integer = Me.RichTextBox1.GetCharIndexFromPosition(New Point(e.X, e.Y))
If ClickedIndex >= StartIndexOfLink AndAlso ClickedIndex <= EndIndexOfLink Then
MessageBox.Show(TheUrl & " was clicked!")
End If
End Sub
handle multiple URL links in a richtextbox
COMGENXP
Matt_
Luis Estrada
Teknoshamn