Today I had to add a way so that a webpage could be displayed with each form in a WinForms application. Doesn’t sound that hard now does it? We’ve developed our own little MVC/MVP framework, so in order to enable this behaviour I just had to create a usercontrol, throw a webbrowser control on it, some logic and done. Our framework automatically detects the control and the end user can add these controls at run time to any form he wants.
The logic I had added to the control detected if a certain file had been clicked, since these had to be handled by the application and not by the webbrowser, really straightforward stuff. In the load event of the control I registered to the necessary events which would trigger my code. The only problem being that the load event was never fired. I looked at my code again, maybe 20 lines or so including brackets and braces, and didn’t see anything wrong with it. I then looked to some other controls my colleagues and I had already written in the past to see if I did something wrong but couldn’t see any big difference. Time for some debugging!
With breakpoints all over the place it was clear that the constructor of my form and presenter was being called and the event subscription was being done but the Load event somehow was never triggered. I went over and over the code again and again but really couldn’t get my head around this. Why on earth wasn’t the event being fired. I even went away from the compiler generated properties back to the old fashioned getters and setters with a field just to make the code look more like all the other controls but nothing worked.
Until I removed the webbrowser control from my usercontrol. Now all of a sudden my load event was being fired, the culprit was found!
So somehow when you use the webbrowser control, your load event, and who knows what else, is fubar. I only found one usable search result on the internet, here. And the workaround mentioned works like a charm, make your webbrowser control invisible until after the load event
. Well in my case the presenter calls NavigateToUri(uri) on my view and in that method I set the visibility of the webbrowser to true. Smells like a bug to me but at least now it’s working, too bad it took 4-5 hours.
Tags: control, webbrowser

stress from clinical duty…
Buy_without prescription…
saline for nebulizer…
Buy_generic pills…
how to get teens off drugs…
Buy_drugs without prescription…
office of generic drug…
Buy_generic drugs…
chronic bronchitis from marijuana…
Buy_now…
decreased appetite during pregnancy…
Buy_generic drugs…
maximum daily dose for venlafaxine…
Buy_it now…
can a woman have colorectal cancer…
Buy_drugs without prescription…
food low in cholesterol…
Buy_now it…
ayurvedic ashwagandha zyban…
Buy_generic pills…
relief of skin itching…
Buy_now it…
clinical diagnosis and medical records…
Buy_generic meds…
eye drops canine paralysis…
Buy_now…
cause for morning erections…
Buy_generic meds…
inpatient drug rehab sanford fl…
Buy_it now…
acyclovir stada cream…
Buy_generic drugs…
long hairstyles…
Thank you for the good writeup. It in fact was a amusement account it. Look advanced to more added agreeable from you! By the way, how can we communicate?…