Readystate for Webbrowser control

Wait till readystate.complete = true in Webbrowser control

Page 1 of 1

2 Replies - 12967 Views - Last Post: 25 March 2008 - 08:54 AM Rate Topic: -----

#1 nealgabriel45  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 4
  • View blog
  • Posts: 46
  • Joined: 22-October 07

Readystate for Webbrowser control

Post icon  Posted 25 March 2008 - 05:49 AM

Hi All,
I am using a Web Browser control in VB Net Application. I am trying to upload some data to the web page from an excel file.
Do While Not rsGetData.EOF
				strTemp = IIf(IsDBNull(rsGetData.Fields("Temp").Value), "", rsGetData.Fields("Temp").Value)
 'This function will click the search btn in the page			 
Call Search()
				Do While WebBrowser.ReadyState <> WebBrowserReadyState.Complete
					Application.DoEvents()
				Loop
				System.Threading.Thread.Sleep(5000)
'My Code for Getting the data from the loaded page goes here
				rsGetData.MoveNext()
			Loop



After loading the data page, the command rsGetData.MoveNext() should work

The above code has a part Application.Doevents and Thread.sleep; Both these events are not working.
I need something which is more efficient than Application.Doevents.
Please Help Me out...
DoEvents will work fine in VB 6.0, But in Dot Net I think this wont...
Hope the Question is Clear //

This post has been edited by nealgabriel45: 25 March 2008 - 05:50 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Readystate for Webbrowser control

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Readystate for Webbrowser control

Posted 25 March 2008 - 08:22 AM

Well there is no replacement for Application.DoEvents, this will simply allow your GUI to be accessible while a long process is running. I use it all the time and have yet to have an issue with it working.

So what exactly is the problem you're having with this code? Can you provide a better explanation please :)
Was This Post Helpful? 0
  • +
  • -

#3 nealgabriel45  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 4
  • View blog
  • Posts: 46
  • Joined: 22-October 07

Re: Readystate for Webbrowser control

Posted 25 March 2008 - 08:54 AM

View PostPsychoCoder, on 25 Mar, 2008 - 08:22 AM, said:

Well there is no replacement for Application.DoEvents, this will simply allow your GUI to be accessible while a long process is running. I use it all the time and have yet to have an issue with it working.

So what exactly is the problem you're having with this code? Can you provide a better explanation please :)

When I am Using Applicaiton.DoEvents, The Webpage will get freezed, This will stop the processing of website and this will generate an infinite loop, Which in turns wont generatethe state as complete.


For Better Understanding, I ll explain the workflow..
The functions I've used includes,
Login -> Which logs in to the webpage using a userid and password. (Works Fine)
SearchData -> Searches for a Data with specifying some details from the excel file. The excel file has some n number of records and each time, I have to seach for a record and get data from another page.
I've used the while loop to iterate thru the records in excel file. During Iteration , I;ve used the function to getdata from the excel(The functin is used in WEBBROWSER_DOCUMENTCOMPLETE fucntion which is a property of the Microsoft Web Browser Control.);
To attain this task, Application.DoEvents is placed. But this wil freeze the web page... So The function is not calling the other function WEBBROWSER_DOCUMENTCOMPLETE.
Guess you got a clear picture of what Exactly i need.

'Appologize for PM
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1