Im making a browser program, I haev a TabControl and i want to dynamically add tabs to it from a 'control' array.
The array contains a structure:
public struct fullTab
{
public System.Windows.Forms.TabPage Tab;
public AxSHDocVw.AxWebBrowser WebBrowser;
};
Everything seems to work fine until I call any WebBrowser's functions it gives me some 'InvalidActiveXStateException' and no additional information.
Here's how I initialize WebBrowser object:
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MainWindow)); //res manager
aTab.WebBrowser = new AxSHDocVw.AxWebBrowser();
aTab.WebBrowser.Visible = true;
aTab.WebBrowser.Location = new System.Drawing.Point(0, 0);
aTab.WebBrowser.Dock = System.Windows.Forms.DockStyle.Fill;
aTab.WebBrowser.Size = new System.Drawing.Size(797, 609);
aTab.WebBrowser.Anchor = System.Windows.Forms.AnchorStyles.None;
aTab.WebBrowser.Enabled = true;
aTab.WebBrowser.AccessibleDescription = resources.GetString("axWebBrowser1.AccessibleDescription");
aTab.WebBrowser.AccessibleName = resources.GetString("axWebBrowser1.AccessibleName");
aTab.WebBrowser.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("axWebBrowser1.Anchor")));
aTab.WebBrowser.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("axWebBrowser1.BackgroundImage")));
aTab.WebBrowser.Enabled = ((bool)(resources.GetObject("axWebBrowser1.Enabled")));
aTab.WebBrowser.Font = ((System.Drawing.Font)(resources.GetObject("axWebBrowser1.Font")));
aTab.WebBrowser.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("axWebBrowser1.ImeMode")));
aTab.WebBrowser.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axWebBrowser1.OcxState")));
aTab.WebBrowser.RightToLeft = ((bool)(resources.GetObject("axWebBrowser1.RightToLeft")));
aTab.WebBrowser.TabIndex = ((int)(resources.GetObject("axWebBrowser1.TabIndex")));
aTab.WebBrowser.Text = resources.GetString("axWebBrowser1.Text");
I made a dummy WebControl and using it's resources to initialize the new ones. If I simply ad it to a form from the designer then it works fine, but not if i do it like this... can someone help me here? This is pissing me of beyond belief!!!
The array contains a structure:
public struct fullTab
{
public System.Windows.Forms.TabPage Tab;
public AxSHDocVw.AxWebBrowser WebBrowser;
};
Everything seems to work fine until I call any WebBrowser's functions it gives me some 'InvalidActiveXStateException' and no additional information.
Here's how I initialize WebBrowser object:
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MainWindow)); //res manager
aTab.WebBrowser = new AxSHDocVw.AxWebBrowser();
aTab.WebBrowser.Visible = true;
aTab.WebBrowser.Location = new System.Drawing.Point(0, 0);
aTab.WebBrowser.Dock = System.Windows.Forms.DockStyle.Fill;
aTab.WebBrowser.Size = new System.Drawing.Size(797, 609);
aTab.WebBrowser.Anchor = System.Windows.Forms.AnchorStyles.None;
aTab.WebBrowser.Enabled = true;
aTab.WebBrowser.AccessibleDescription = resources.GetString("axWebBrowser1.AccessibleDescription");
aTab.WebBrowser.AccessibleName = resources.GetString("axWebBrowser1.AccessibleName");
aTab.WebBrowser.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("axWebBrowser1.Anchor")));
aTab.WebBrowser.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("axWebBrowser1.BackgroundImage")));
aTab.WebBrowser.Enabled = ((bool)(resources.GetObject("axWebBrowser1.Enabled")));
aTab.WebBrowser.Font = ((System.Drawing.Font)(resources.GetObject("axWebBrowser1.Font")));
aTab.WebBrowser.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("axWebBrowser1.ImeMode")));
aTab.WebBrowser.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axWebBrowser1.OcxState")));
aTab.WebBrowser.RightToLeft = ((bool)(resources.GetObject("axWebBrowser1.RightToLeft")));
aTab.WebBrowser.TabIndex = ((int)(resources.GetObject("axWebBrowser1.TabIndex")));
aTab.WebBrowser.Text = resources.GetString("axWebBrowser1.Text");
I made a dummy WebControl and using it's resources to initialize the new ones. If I simply ad it to a form from the designer then it works fine, but not if i do it like this... can someone help me here? This is pissing me of beyond belief!!!