troubleshooting Question

I got this exception . How to solve this ? Exception :Exception of type 'System.Windows.Forms.AxHost+InvalidActiveXStateException' was thrown.

Avatar of Teenu R
Teenu R asked on
3 Comments2 Solutions149 ViewsLast Modified:
I have a windows form  and two ocx controls are  added in this form. At runtime i got this exception.I think the exception is occurred when initialize the occ controls. i attached my code below. please help me . its very urgent.

using AxVSpinAccess2Lib;
using AxVSpinLib;
namespace VspinCentrifugeIntegration
    partial class frmInstrument
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)

                if (disposing && (components != null))


        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
                System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmInstrument));
                this.axVSpin1 = new AxVSpinLib.AxVSpin();
               // axVSpin1.CreateControl();
                this.axVSpinAccess21 = new AxVSpinAccess2Lib.AxVSpinAccess2();
                this.performanceCounter1 = new System.Diagnostics.PerformanceCounter();
                // axVSpin1
                this.axVSpin1.CausesValidation = false;
                this.axVSpin1.Enabled = true;
                this.axVSpin1.Location = new System.Drawing.Point(46, 23);
                this.axVSpin1.Name = "axVSpin1";
                this.axVSpin1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axVSpin1.OcxState")));
                this.axVSpin1.Size = new System.Drawing.Size(100, 50);
                this.axVSpin1.TabIndex = 0;
                this.axVSpin1.Visible = false;
                // axVSpinAccess21
                this.axVSpinAccess21.CausesValidation = false;
                this.axVSpinAccess21.Enabled = true;
                this.axVSpinAccess21.Location = new System.Drawing.Point(64, 89);
                this.axVSpinAccess21.Name = "axVSpinAccess21";
                this.axVSpinAccess21.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axVSpinAccess21.OcxState")));
                this.axVSpinAccess21.Size = new System.Drawing.Size(100, 50);
                this.axVSpinAccess21.TabIndex = 1;
                this.axVSpinAccess21.Visible = false;
                // frmInstrument
                this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                this.ClientSize = new System.Drawing.Size(231, 151);
                this.Name = "frmInstrument";
                this.Text = "frmInstrument";



        private AxVSpin axVSpin1;
        private AxVSpinAccess2 axVSpinAccess21;
        private System.Diagnostics.PerformanceCounter performanceCounter1;
Freelance programmer / Consultant

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros