?
Solved

How to add a tooltip to an extended richtextbox link

Posted on 2004-11-04
7
Medium Priority
?
410 Views
Last Modified: 2007-12-19
I was wondering if there was a way to add tooltip text to a link located in a richtextboxex.

Thanks
Geoff
0
Comment
Question by:gbarcalow
  • 3
  • 3
6 Comments
 
LVL 27

Expert Comment

by:planocz
ID: 12505262
Is this a link text inside of a richtextbox?\
or can you use a LinkLabel control?
0
 
LVL 3

Author Comment

by:gbarcalow
ID: 12505657
No I need a tooltip for the link text inside the richtextbox
0
 
LVL 27

Expert Comment

by:planocz
ID: 12507809
This is close as I can get

   Private Sub RichTextBox1_LinkClicked(ByVal sender As Object, ByVal e As System.Windows.Forms.LinkClickedEventArgs) Handles RichTextBox1.LinkClicked
        tipView.SetToolTip(Me.RichTextBox1, "Here to link")
        e.GetType()
    End Sub
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Author Comment

by:gbarcalow
ID: 12508404
I have to following code
my problem is that "txtData.GetCharIndexFromPosition" is not returning the expected values.
To me it seems to choose a random integer for each line that you move over.
I think that if I could get the real index from txtData.GetCharIndexFromPosition this code would work.

    Private Sub txtData_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles txtData.MouseMove

        Dim pt As Point = New Point(e.Y, e.Y)
        Dim link As Integer = txtData.GetCharIndexFromPosition(pt)

        If isLink(link) = True Then
            tt_txtData.Active = True
            tt_txtData.SetToolTip(txtData, "Click Here to open document")
        Else
            tt_txtData.Active = False
        End If

    End Sub

    Private Function isLink(ByVal i As Integer)
        Dim sData As String = txtData.Text

        Dim strBeg As String = Replace(Strings.Left(sData, i), vbCrLf, " ")
        Dim strEnd As String = Replace(Strings.Right(sData, Len(sData) - i), vbCrLf, " ")

        Dim strComplete = Strings.Right(strBeg, Len(strBeg) - InStrRev(strBeg, " "))
        strComplete += Strings.Left(strEnd, InStr(strEnd, " "))

        If UCase(Strings.Left(strComplete, 7)) = "HTTP://" Or _
            UCase(Strings.Left(strComplete, 7)) = "FILE://" Then

            Return True
        Else
            Return False
        End If

    End Function
0
 
LVL 27

Accepted Solution

by:
planocz earned 250 total points
ID: 12508581
It works if each line has a vbNewLine on the end, and the Http is not the last line of the code.
0
 
LVL 3

Author Comment

by:gbarcalow
ID: 12509416
So that pretty much rules out using word wrap huh?
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Loops Section Overview
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question