views:

182

answers:

1

I would like my custom browser to auto fill in a form when it is completely loaded

Ok so inside

   private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
    { }

Ive inserted the following statements

webBrowser1.Document.GetElementById("FirstName").SetAttribute("value", "John");
webBrowser1.Document.GetElementById("LastName").SetAttribute("value", "Smith");
// etc..etc..

I noticed that "webBrowser1_DocumentCompleted" only is loaded one time?? How do i make my browser auto fill in a form when the document has finish loading, and auto fill the values to the define values if they have been changed by the end user.

A: 

auto fill in a form when the document has finish loading You need to skip the documentcomplete events triggered frames. Hint: check the webbrowser's status property.

auto fill the values to the define values if they have been changed by the end user. In the Navigating event handler, get the form values and save them somewhere, preferably after encryption.

If you do not provide your own password storage and want to use Windows's, check http://social.msdn.microsoft.com/forums/en-US/winformsdesigner/thread/db373409-9366-47bd-bdf0-79493ffa0f22/

Sheng Jiang 蒋晟