ok i have a timer that is on no matter what on my form and when it gets to a certain site i want it to enable stuff so here is my code.
[php] If WebBrowser1.Url.AbsoluteUri = ("www.google.com") = True & WebBrowser1.ReadyState = WebBrowserReadyState.Complete Then
Timer1.Stop()
Button3.Enabled = True
End If
If Button3.Enabled = True Then
subm.Enabled = False
End If[/php]
So really the error is this part
(i think)
Code:
If WebBrowser1.Url.AbsoluteUri = ("www.google.com") = True
it says there is no problem but when i run the program it shuts it down (i think its cause of the timer i have running)
Thanks in advance.
(if you do help me plz explain it to me so i can use it for future reference and know how it works.)
This should do it, Put this inside your document completed
[php]
Dim Url As String = WebBrowser1.Url.AbsoluteUri
Dim FUrl As Boolean = False
If Url.Contains("www.google.com") Then
FUrl = True
Else
FUrl = False
End If
If FUrl = True Then
' What you want to happen if it is true
ElseIf FUrl = False Then
' what you want to happen if it is false
End If
[/php]
Side note, contains is probably one of my favorite most useful webbrowser features (which is why I use it as the example)
Other methods you could use would be in the same scope as above.
[php]
If WebBrowser1.Document.Domain.Contains("google") Then
End If
[/php]
[php]
If WebBrowser1.Document.Domain = ("www.google.com") Then
End If
[/php]
You can use contains in many ways,
Example: Goto Google and type in the word food, then search
then you can use this code
[php]
If WebBrowser1.Document.Body.InnerHtml.Contains("food ") Then
MsgBox("food")
End If
[/php]
This can be used for 1000's of things, so it would be good to get used to it when dealing with web manipulation.
A Timer to see when a Mod is inside of the forums.
in timer event
[php]
If WebBrowser1.Document.Body.InnerHtml.Contains("[Nig]King[Ga]") Then
MsgBox("Mod In Thread")
End If
[/php]
There are alot of variables, and not that it would be a useful or good feature, but it's to give you a understanding of what contains can do, you can use it to search Heads , Body's, Url , etc.
for specific words or keywords,
You can use it to create Kid friendly browser, like a feature that blocks out certain words.
[php]
If Webbrowser1.document.body.contains("hell") then
[/php]
Replace any element contain hell . innertext or .innerhtml with ******** or [content blocked]
Originally Posted by NextGen1
This should do it, Put this inside your document completed
[php]
Dim Url As String = WebBrowser1.Url.AbsoluteUri
Dim FUrl As Boolean = False
If Url.Contains("www.google.com") Then
FUrl = True
Else
FUrl = False
End If
If FUrl = True Then
' What you want to happen if it is true
ElseIf FUrl = False Then
' what you want to happen if it is false
End If
[/php]
Well it works for me delete this post and close the thread plz.