tags:

views:

354

answers:

1

I just developed a very simple ActiveX control(using the VS.NET wizard, not even change a line), and compiled it. After running "regsvr32 ax1.ocx", I created a new C# WinFrom project and drag the ActiveX control into the form. Then I build and run it, the error says:

Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))

within the line:

((System.ComponentModel.ISupportInitialize)(this.axax11)).EndInit();

The entire function is:

    private void InitializeComponent()
    {
        System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
        this.axax11 = new Axax1Lib.Axax1();
        ((System.ComponentModel.ISupportInitialize)(this.axax11)).BeginInit();
        this.SuspendLayout();
        // 
        // axax11
        // 
        this.axax11.Enabled = true;
        this.axax11.Location = new System.Drawing.Point(103, 90);
        this.axax11.Name = "axax11";
        this.axax11.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axax11.OcxState")));
        this.axax11.Size = new System.Drawing.Size(100, 50);
        this.axax11.TabIndex = 0;
        // 
        // Form1
        // 
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(284, 262);
        this.Controls.Add(this.axax11);
        this.Name = "Form1";
        this.Text = "Form1";
        ((System.ComponentModel.ISupportInitialize)(this.axax11)).EndInit();
        this.ResumeLayout(false);

    }
+4  A: 

I'll assume you wrote your ActiveX control in unmanaged C++ code. You'll need to either create a 64-bit version of this control or you need to force the .NET program that uses it to run in 32-bit mode. The latter is the quicker fix, Project + Properties, Build tab, Platform Target = x86.

Hans Passant
Thanks, that's cool!
Bin Chen
That's what I did to fix my own problem/question.
Jason D
@nobugz, Too bad you weren't logged in when I posted the original question, you'd have saved me some time. :-)
Jason D