Hey. I just added a website url to my rich textbox and it automatically underlines it. Is there a way that I can make it so if the user clicks on that link within the textbox then it will open up the link? thanks!!
John
Printable View
Hey. I just added a website url to my rich textbox and it automatically underlines it. Is there a way that I can make it so if the user clicks on that link within the textbox then it will open up the link? thanks!!
John
Hi,Quote:
Originally Posted by JohnRChick
I think you cab do it in another way.
Create a LinkLabel in your RTB and name it like your URL.
See this code:
VB Code:
Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked TextBox1.Text = "Hello there" End Sub
Hope it helps,
sparrow1
hmm but the thing is that then the link away stays where you put it in the text box.. my url is at the bottom so its only visible when the user scrolls down
I found a link about URL'sQuote:
Originally Posted by JohnRChick
http://www.vbforums.com/showthread.p...hlight=url%27s
Hope it's better
sparrow1
uhh that doesn't really help haha any more ideas
any ideas...
Hi John,Quote:
Originally Posted by JohnRChick
Yes I know It's me again, and again with a few links, but this time you'll find
some explanation about LinkControl;
http://msdn.microsoft.com/library/de...inkControl.asp
http://msdn.microsoft.com/library/de...inkControl.asp
http://msdn.microsoft.com/library/de...inkcontrol.asp
I hope it really helps you this time!
sparrow1
The RichTextBox has a LinkClicked event where you would handle what you want to do when a link is clicked.
An example from documentation:
VB Code:
Public p As New System.Diagnostics.Process Private Sub RichTextBox1_LinkClicked(ByVal sender As Object, ByVal e As System.Windows.Forms.LinkClickedEventArgs) _ Handles RichTextBox1.LinkClicked ' Call Process.Start method to open a browser ' with link text as URL. p = System.Diagnostics.Process.Start("IExplore.exe", e.LinkText) End Sub