Webbrowser document complete
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
5 posts
Page 1 of 1
Whenever i use webbrowser1.documentcompleted im adding a string to a listview but it adds the same string 3 times how can i stop it from doing that, the only thing the webbrowser does it to get the title of the website, and also if there is an easier way to do it than using a webbrowser please tell me
You could use HTTPWebRequest to get the contents of the document, and then just extract the title from there.
comathi wrote:You could use HTTPWebRequest to get the contents of the document, and then just extract the title from there.Could you help me out on that ?
Code: Select all
If you need help using the code, I'd be glad to lend you a hand in TeamViewer ;)Try
Dim request As Net.HttpWebRequest = Net.HttpWebRequest.Create("http://www.codenstuff.com/forum/home.php")
Dim response As Net.HttpWebResponse = request.GetResponse
Dim stream As IO.Stream = response.GetResponseStream
Dim reader As New IO.StreamReader(stream)
Dim content As String = reader.ReadToEnd
Dim lowerContent As String = content.ToLower()
Dim startIndex As Integer = lowerContent.IndexOf("<title>") + 7
Dim stopIndex As Integer = lowerContent.IndexOf("</title")
Dim title As String = content.Substring(startIndex, stopIndex - startIndex)
Label1.Text = title
Catch ex As Exception
MsgBox(ex.ToString())
End Try
AnoPem wrote:Whenever i use webbrowser1.documentcompleted im adding a string to a listview but it adds the same string 3 times how can i stop it from doing thatYou could just check and set a variable during the DocumentComplete event so it only adds the string once.
5 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023