Test.htm
/// summary> private void InitializeComponent () ... {System.Resources.ResourceManager resources = new System.Resources.ResourceManager (typeof (Form1)); this.axWebBrowser1 = new AxSHDocVw.AxWebBrowser (); this.button1 = new System.Windows.Forms.Button (); this.button2 = new System.Windows.Forms.Button ();. ((System.ComponentModel.ISupportInitialize) (this.axWebBrowser1)) BeginInit (); this.SuspendLayout ( ); // // axWebBrowser1 // this.axWebBrowser1.Enabled = true; this.axWebBrowser1.Location = new System.Drawing.Point (80, 184); this.axWebBrowser1.OcxState = ((System.Windows.Forms.AxHost .State) ("AxWebBBBBBBBBBBBBROWSTATATE)))))))); this.axwebbrowser1.size = new system.drawing.size (300, 150); this.axwebbrowser1.tabindex = 0; // // button1 // This.button1.location = new system.drawing.point (160, 96); this.button1.name = "button1"; this.button1.size = new system.drawing.size (88, 24); this.button1. TabINDEX = 1; this.button1.text = "Butto N1 "; this.button1.click = new system.eventhandler (this.button1_click); // // button2 // this.button2.location = new system.drawing.point (304, 96); this.button2.name = "Button2"; this.button2.tabindex = 2; this.button2.text = "button2"; this.button2.click = new system.eventhandler (this.button2_click); // // form1 // this.autoscalebasesize = new system.drawing.size (6, 14); this.clientsize = new system.drawing.size (584, 397); this.controls.add (this.button2); this.controls.add (this.button1) Im.controls.add (this.axwebbrowser1); this.name = "form1";
This.Text = "form1"; (this.Axwebbrowser1)). endinit (); this.ResumeLayout (false);} #ENDREGON / ** //// ////// The main entry point for the application. /// summary> [stathread] static void main () ... {Application.Run (new form1 ());} private void button1_click (Object sender, system.eventargs e) ... {Object x = system .Reflection.Missing.Value; AxWebBrowser1.navigate (@ "E: / documents and settings / administrator / desktop /test.htm", REF X, REF X, REF X, REF X);} private void button2_click System.EventArgs e) ... {mshtml.IHTMLDocument2 doc = (mshtml.IHTMLDocument2) axWebBrowser1.Document; mshtml.IHTMLFormElement f1 = (mshtml.IHTMLFormElement) doc.all.item ( "form1", 0); ((mshtml. IHTMLFORMELEMENT (F1)). Submit (); mshtml.ihtmlelement element = (mshtml.ihtmlelement) Doc.all.Item ("Button1", 0); Element.click ();}}} attached: How to simulate IE If you are using a form submission is the WebBrowser control: you can access the entire HTML DOM, set the input value, then submit:?. mshtml.IHTMLDocument2 doc = (mshtml.IHTMLDocument2) webbrowser.Document; mshtml.IHTMLInputElement ele = (mshtml.IHTMLInputElement) Doc.all.Item ("name", 0); ele.value = "user"; ... mshtml.ihtmlFormElement element element element element element element ELE = (MSHT ml.ihtmlformElement) Doc.all.Item ("MyForm", 0); ele.submit ();