[Help] WebBrowser events. [Solved]

Posts 1–15 of 16 · Page 1 of 2
[Help] WebBrowser events. [Solved]
Hey guys almost finished making a very gd account creater im just having one problem. I want the program to automatically grab the captcha but i cant fiqure out a way to do it becuase, if i put it in a timer it crashes the program because the webbrowser has not fully loaded as soon as it starts. is there a easy way around this. its probably simple but im still learning, if someone could wight me a simple bit of code i will give you credits when i release. Im using visual basic 2010

Thanks.
So ur having trouble with when the browser opens? I'm not sure I fully understand your question
Make the timer start on WebBrowser1_DocumentCompleted()
Search button.

Asked 5465465465466 Times
Quote Originally Posted by Lyoto Machida View Post
Search button.

Asked 5465465465466 Times
my bad i searched through the tut list and could not see anything its not like i didnt look, but thanks for the help guys.

Quote Originally Posted by Hawk_ View Post
Make the timer start on WebBrowser1_DocumentCompleted()
Do i need to import any settings it does not seem to see document completed as a command, im using visual basic 2010
Quote Originally Posted by Lyoto Machida View Post
.................But he uses a button I already know how to do a button, as i said i need a way so the code executes when the webbrowser has finished loading but im not aware of the code to do that. As for me searching i did i already used another tut i just didnt see that one.
Quote Originally Posted by silentrunner2 View Post
.................But he uses a button I already know how to do a button, as i said i need a way so the code executes when the webbrowser has finished loading but im not aware of the code to do that. As for me searching i did i already used another tut i just didnt see that one.
Do something like this:

If WebBrowser.ReadyState = BlabLABLABAL.COmplete Then

' Code

End if
Code:
 If WebBrowser1.ReadyState = WebBrowserReadyState.Complete Then
            PictureBox2.ImageLocation = WebBrowser1.Document.GetElementById("imgPic").GetAttribute("src")
        End If
Im using that but it still crashes, if i have the normal code in a button it works fine :/ am i being an idoit and doing something wrong.
Quote Originally Posted by silentrunner2 View Post
Code:
 If WebBrowser1.ReadyState = WebBrowserReadyState.Complete Then
            PictureBox2.ImageLocation = WebBrowser1.Document.GetElementById("imgPic").GetAttribute("src")
        End If
Im using that but it still crashes, if i have the normal code in a button it works fine :/ am i being an idoit and doing something wrong.
Go on webbrowser events then search for Complete or something like the Hawk said..
Quote Originally Posted by Lyoto Machida View Post


Go on webbrowser events then search for Complete or something like the Hawk said..
ok thanks finally got it to work was switching it around and everything didnt seem to be working then it just did
Quote Originally Posted by Lyoto Machida View Post
Nice to know =)
Thanks for ur help, last thing how would i also confirm the url in the same line of code, i tried just doing "and" and adding webbrowser1.url = "the url here" it didnt like it?

Thanks
The Url isn't a string, the error probably relates to that...which is why it's important that you actually say what error you're getting rather than just saying "I'm getting an error". As for the captcha grabbing, don't do it in a timer. Handle the Document_Completed event only. On that event you should have something like:
[highlight=vb.net]
If WebBrowser1.ReadyState = 4 AndAlso WebBrowser1.Url.TOSTRING = "ohhaider" 'MUST CALL TOSTRING ON THE URL.
//get captcha
End If
[/highlight]
Once again thanks for the great help, thats why i love this forum. Yh soz for not being more specific 5am in the morning and it was driving me nuts because i new it was something simple. My skills with visual basic are ok my memory is just terrible i often forget bits and pieces. you will get creds upon release i may forget to put it in the thread but it will be in the program.
Posts 1–15 of 16 · Page 1 of 2
This thread is closed for replies.

Tags for this Thread

None

Talk with us