How do I determine the URL that has been clicked

Robert Barnes 101 Reputation points
2024-08-12T04:04:16.7633333+00:00

I am enhancing the Help System for MANASYS Jazz. I have replaced a TextBox with a RichTextBox, and now if Error Help includes URL's these are identified in the usual way - they are blue, and the cursor becomes a hand when it's over them: -

User's image

I want to be able to open these URL's by clicking them. I can use the MouseUp event to detect where the mouse has been clicked

    Private Sub rtxErrorDescription_MouseUp(sender As Object, e As MouseEventArgs) Handles rtxErrorDescription.MouseUp
        HelpPoint = New Point(e.X, e.Y)
    End Sub

Is there an easier way of finding the URL that includes point X=342, Y=73 than working out the line containing this point and analyzing the line to find the beginning and end of the URL?

Thank you, Robert Barnes

Developer technologies | VB
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Jiachen Li-MSFT 34,221 Reputation points Microsoft External Staff
    2024-08-12T05:50:23.2133333+00:00

    Hi @Robert Barnes ,

    You can use the RichTextBox's LinkClicked event.

    User's image

    Best Regards.

    Jiachen Li


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.