Create Axwebbrowser with new Tabpage (VS2005)
C#
1
Posts
1
Posters
0
Views
1
Watching
-
Hi , I am a beginner in C# and just looking for a function to create dynamic several Webbrowser in a Tabpage. I use the Microsoft Webbrowser AxSHDocVw.AxWebBrowser Control in my application. If i invoke the void a firsttime it runs, but at the second click I get a errormessage Exception Typ : System.Windows.Forms.AxHost+InvalidActiveXStateException This is my Code:
void myTabPageAxWebbbrowser() { TabPage myTabPg = new TabPage(); AxSHDocVw.AxWebBrowser myWB = new AxSHDocVw.AxWebBrowser(); object empty = System.Reflection.Missing.Value; System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1)); myTabPg.SuspendLayout(); this.tabControl1.Controls.Add(myTabPg); myTabPg.Controls.Add(myWB); myTabPg.Location = new System.Drawing.Point(10, 30); myTabPg.Name = "MyNewPage"; myTabPg.Padding = new System.Windows.Forms.Padding(3); myTabPg.Size = new System.Drawing.Size(650, 500); myTabPg.TabIndex = 1; myTabPg.Text = "MyNewTab"; myTabPg.UseVisualStyleBackColor = true; myTabPg.ResumeLayout(false); myWB.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("myWB.OcxState"))); myWB.Dock = System.Windows.Forms.DockStyle.Fill; Debug.WriteLine(myWB.OcxState.ToString()); myWB.Navigate("c:\\test.doc", ref empty, ref empty, ref empty, ref empty);// } Does anybody know how can I solve the Problem? Thanks in Advance Cola 1973 :)