VBNewbie101

Member
Joined
Jun 4, 2008
Messages
6
Programming Experience
Beginner
Hey guys sorry I'm sort of new at this, so I apologise in advance if the thread is in the wrong area of the forum or if the problem I am having is actually very simple, but all the same I do need help.

Basically I am creating a form in VB.NET Version 3.5 , with the web browser function, and I would like the form to refresh over and over on a particular web page, and when a link is enabled on that web page, I would like the form to open that newly enabled link, and make a beeping sound.

Im not sure if i have worded that well or not, i guess i will just wait and see if I get any responses, if needed, I can respond to questions you may have in this thread

Thanks

Newbie101
 
Viewing Website Source

I need to do is create a function that will look through the source code of the website displayed within my web broswer on my form, and then notify my when an image appears on that web page.

If anyone could point me in the right direction about how to make a code that will look through a websites source code and locate an image, it would be most helpful

Newbie101
 
Source is available in DocumentText property, but you'd rather be looking at .Document.Images, .Document.GetElementsByTagName, .Document.GetElementById and the like.
 
OK how about...

Ok lets say I wanted to use this function on this forum, I would like a MsgBox to appear when the code reads that "http://www.vbdotnetforums.com/images/vbdn/MainLogo.gif" is in the web browser box.

How would I do this?
 
You could use the DocumentCompleted event, check your content when ReadyState=Complete.
 
Doubleclick the browser control and a handler method for its default event DocumentCompleted is generated. Here you check ReadyState before you do your document/source investigation. Example to check ReadyState in DocumentCompleted event handler:
VB.NET:
If Me.WebBrowser1.ReadyState = WebBrowserReadyState.Complete Then
    'here you can check content and do your thing

End If
 
Is there a quicker way that I could contact you because I am still pretty stuck.

This is a helper code that I found online, does it look similar to what I am trying to achieve?

Private Sub DisplayMetaDescription()
If (WebBrowser1.Document IsNot Nothing) Then
Dim Elems As HtmlElementCollection
Dim WebOC As WebBrowser = WebBrowser1

Elems = WebOC.Document.GetElementsByTagName("META")

For Each elem As HtmlElement In Elems
Dim NameStr As String = elem.GetAttribute("name")

If ((NameStr IsNot Nothing) And (NameStr.Length <> 0)) Then
If NameStr.ToLower().Equals("description") Then
Dim ContentStr As String = elem.GetAttribute("content")
MessageBox.Show("Document: " & WebOC.Url.ToString() & vbCrLf & "Description: " & ContentStr)
End If
End If
Next
End If
End Sub
 
I think Ive made some progress, basically I want the program to look through the source of Webbrowser1 and locate every IMG on the page. If for example "http://www.vbdotnetforums.com/images/vbdn/MainLogo.gif" is one of the images that are found, I want a message box to appear saying: MsgBox(""), if it is not on the page, then I want the refreshing timer which I have already made to continue to refresh.

If you would like to get in contact over MSN and teach me how I can make this then please feel free, I will message you with my email address, otherwise when replying to this post, please be specific about what needs to be done to locate an exact image on a web page in Webbrowser1
 
Back
Top