How to display the anchor text of a link in a label ???!!!!!!! a
I need to display in a label the anchor text of a link, this link is in a website for example:
<a href="url">Link text</a>
I need display in the label the "Link Text" . I only know the url for example :
http://www.adoretube.com , so if the link is :
<a href="http://www.adoretube.com">videos cristianos</a> I need display in the label "videos cristianos" or if the link is :
<a href="http://www.adoretube.com">musica</a> I want to display "musica"
Can you help me?
Re: How to display the anchor text of a link in a label ???!!!!!!! a
Set the LinkLabel Text property to any text you want and in the event LinkClicked use the target url address you want to visit.
vb Code:
Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
LinkLabel1.LinkVisited = True
System.Diagnostics.Process.Start("C:\Program Files\Internet Explorer\iexplore.exe", "www.msdn.com")
End Sub
Re: How to display the anchor text of a link in a label ???!!!!!!! a
Thanks but I need other thing. I need to extract the anchor text (innertext) and display it in a label.
Quote:
Originally Posted by
4x2y
Set the LinkLabel Text property to any text you want and in the event LinkClicked use the target url address you want to visit.
vb Code:
Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
LinkLabel1.LinkVisited = True
System.Diagnostics.Process.Start("C:\Program Files\Internet Explorer\iexplore.exe", "www.msdn.com")
End Sub
Re: How to display the anchor text of a link in a label ???!!!!!!! a
Ah... Sorry, misunderstood
Try this function
vb Code:
Private Function GetAnchor(ByVal strUrl As String) As String
Dim intL As Integer
Dim intG As Integer
intG = strUrl.IndexOf(">") + 1
intL = strUrl.IndexOf("<", intG)
Return strUrl.Substring(intG, intL - intG)
End Function