Click here to Skip to main content
15,905,785 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
I have a problem with WPF browser. i want to load a web page. Wait for it load completely and then put few search inputs and then retrieve the result and put it in excel.

I am unable to do so, main program loads and completes the execution before the
pagecomplete_event 
is loaded. The scenario is:

load a component provider website
go to the search option and search for the part number which I am reading for a EXCEL file
put the part number in the search bar and click search
download the details
repeat the steps for MANY parts
I have done this with WinForms, and it works well. The problem is calling DOEVENTS. It sometimes makes my program hang, especially if operating on a big list. So wanted to do it in WPF.

I have put the Load_Complete event, but as I mentioned, it comes to that event after the main program has finished.

I searched and got this link: How to create and use WebBrowser in background thread. But it doesn't seem to help - there seems to be no System.Windows.Deployment in WPF - I get red squiggly underline. No other solutions that I have found seem to help, either.
Posted
Comments
govardhan4u 24-May-13 7:19am    
you can show a wait screen once you click the button and close it once completed
Manu_vish 24-May-13 7:27am    
if you have an code can you please post it.

1 solution

If it works well in WinForms but hangs on a big list, WPF is not going to help. You will have the same problem. The problem is that you are performing too much work on the UI thread. As your search revealed, you need to do that on a background thread. Read up on the System.ComponentModel.BackgroundWorker class. It is an easy way to get introduced to threading.
 
Share this answer
 
Comments
Manu_vish 27-May-13 0:52am    
ok will try this

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900