Title explains it all, 1 of these answers will solve my problem.
Problem: Get's the source before the page loads, solved by putting a msgbox infront so it will "sleep" the code without freezing it.
(Sep 7, 2011 07:40 AM)SIM-524734 Wrote: Title explains it all, 1 of these answers will solve my problem.
Problem: Get's the source before the page loads, solved by putting a msgbox infront so it will "sleep" the code without freezing it.
I don't really understand you question, but if you are wanting thebsource of a website, use a webclient to download it.
for webbrowser is webbrowser_documentcompleted or something like this
system.threading.thread.sleep(time)
or using system time.
Sep 7, 2011 07:45 AM
(This post was last modified: Sep 7, 2011 07:47 AM by SIM-524734.)
(Sep 7, 2011 07:43 AM)Chuck Norris . Wrote: for webbrowser is webbrowser_documentcompleted or something like this
system.threading.thread.sleep(time)
or using system time.
system.threading.thread.sleep(time)
^^ Freezes the program for that time.
webbrowser_documentcompleted
^^ Have no idea what you talking about, well, you can sub it but then I need multiple pages.
or using system time.
^^ How you do that :S
(Sep 7, 2011 07:43 AM)Coleak Wrote: I don't really understand you question, but if you are wanting thebsource of a website, use a webclient to download it.
Heres the problem, I have semi-slow internet, so when I navigate the webbrowser to a webpage it takes about 3 seconds to load, but it gets the source code before it loads. Therefore the source code (html) of the page doesn't appear, but when I add a messagebox for the program to wait and load the page, and then press ok to execute the rest of the code, it works.
(Sep 7, 2011 07:45 AM)SIM-524734 Wrote: system.threading.thread.sleep(time)
^^ Freezes the program for that time.
webbrowser_documentcompleted
^^ Have no idea what you talking about, well, you can sub it but then I need multiple pages.
or using system time.
^^ How you do that :S
Heres the problem, I have semi-slow internet, so when I navigate the webbrowser to a webpage it takes about 3 seconds to load, but it gets the source code before it loads. Therefore the source code (html) of the page doesn't appear, but when I add a messagebox for the program to wait and load the page, and then press ok to execute the rest of the code, it works.
So your objective here is to download a sites source?
(Sep 7, 2011 07:50 AM)Coleak Wrote: So your objective here is to download a sites source?
mmyes, but I can't do that if the page didn't load first.
(Sep 7, 2011 07:45 AM)SIM-524734 Wrote: system.threading.thread.sleep(time)
^^ Freezes the program for that time.
webbrowser_documentcompleted
^^ Have no idea what you talking about, well, you can sub it but then I need multiple pages.
or using system time.
^^ How you do that :S
Heres the problem, I have semi-slow internet, so when I navigate the webbrowser to a webpage it takes about 3 seconds to load, but it gets the source code before it loads. Therefore the source code (html) of the page doesn't appear, but when I add a messagebox for the program to wait and load the page, and then press ok to execute the rest of the code, it works.
Code Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
End Sub
and use a timer...
Code Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'do what u want here
Timer1.Stop()
End Sub
Sep 7, 2011 08:02 AM
(This post was last modified: Sep 7, 2011 08:03 AM by FileX.)
Code WebBrowser1.Navigate("http://www.lol.com")
While WebBrowser1.ReadyState <> WebBrowserReadyState.Complete 'When WebBrowser complete page's loading..
Application.DoEvents()
End While
Sep 7, 2011 08:03 AM
(This post was last modified: Sep 7, 2011 08:04 AM by SIM-524734.)
(Sep 7, 2011 07:55 AM)Chuck Norris . Wrote: Code Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
End Sub
and use a timer...
Code Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'do what u want here
Timer1.Stop()
End Sub
Yes, I had the timer plan as a backup, but I don't want to make the shit confusing and messy so I was wondering if theres an alternative.
(Sep 7, 2011 08:02 AM)FileX Wrote: Code WebBrowser1.Navigate("http://www.lol.com")
While WebBrowser1.ReadyState <> WebBrowserReadyState.Complete 'When WebBrowser complete page's loading..
Application.DoEvents()
End While
Thank you very much! This method had worked! Props to you sir.
(Sep 7, 2011 08:03 AM)SIM-524734 Wrote: Yes, I had the timer plan as a backup, but I don't want to make the shit confusing and messy so I was wondering if theres an alternative.
Thank you very much! This method had worked! Props to you sir.
No pleasure dude :) Feel free to ask if you need any help.
Or try this simple code:
Imports system.net
Dim wc as new webclient
Dim website as string = "www.website.com"
Dim websitesource as string = wc.downloadstring(website)
messagebox(websitesource)
|