Results 1 to 6 of 6

Thread: [Exception] Class not registered

  1. #1

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    [Exception] Class not registered

    Hello everybody,

    I am getting following exception while opening a form in a separate thread.

    Code:
    An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in system.windows.forms.dll
    
    Additional information: Class not registered
    Exception throws on following line in InitializeComponent() method.

    Code:
    this.Load += new System.EventHandler(this.frm_DesingTemplate_Load);
    			((System.ComponentModel.ISupportInitialize)(this.axDrawingControl1)).EndInit();
    Here is the code for sending methods on thread.

    Code:
    		private void PrintAndDraw(bool IsDrawDrawing,bool IsPrintReport)
    		{
    			try
    			{
    				if(IsPrintReport)
    				{
    					ThreadStart reportThreadStart = new ThreadStart(PrintWorkOrder);
    					Thread reportThread = new Thread(reportThreadStart);
    					reportThread.Start();
    				}
    				
    				if(IsDrawDrawing)
    				{
    					ThreadStart drawingThreadStart = new ThreadStart(DrawDrawing);
    					Thread drawingThread = new Thread(drawingThreadStart);
    					drawingThread.Start();
    				}				
    			}
    			catch(Exception ex)
    			{
    				MessageBox.Show(ex.Message);
    			}
    		}
    Here is the method under which exception is thrown.
    Code:
    		private void DrawDrawing()
    		{
    			long ComplaintCode = Convert.ToInt64(this.clsComplaintCode);
    			int ModelCode = Convert.ToInt32(this.cboMCModel.SelectedValue);
    			int ManufacturerCode = Convert.ToInt32(this.cboMCManufacturer.SelectedValue);
    			string strWOrder = txtMCWorkOrder.Text; 
    
    			frm_DesingTemplate frmComp = new frm_DesingTemplate(ComplaintCode , ModelCode, ManufacturerCode, strWOrder);
    			frmComp.Show(); 		
    		}
    Exception is thrown in the InitializeComponent() of frm_DesingTemplate form. A visio drawing control has been used on this form.

    Any ideas to resolve this issue ??

    Thanks.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [Exception] Class not registered

    It looks like you are trying to use an unregistered ActiveX control. I've never worked in COM specifically and only a little through .NET but I believe that COM classes need to be registered on the machine to be able to be used. I think you can have that done automatically as part of your installation routine. Have you picked up that I'm not 100% sure about this?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    Re: [Exception] Class not registered

    Yes, it might be possible. But if I do not send methods on thread, application works fine. Moreover, I have tried this code on a machine where Visio is installed but the problem is same.

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: [Exception] Class not registered

    1) Does it work in your main thread?

    2) Yes you need to register COM libraries. You can do this either by using the unmanaged GetProcAddress() API to call the library's DllRegisterServer() export, or by using the regsvr32.exe tool and passing the path name of the library.

  5. #5

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    Re: [Exception] Class not registered

    If I do not use threading and call the two methods sequentially then code works for me.

    Moreover, I tried to register all the DLLs present in my Debug folder with regsvr32 command. It says "Path of Dll\Interop.Visio.Dll was loaded, but the DllRegisterServer entry point was not found. This file cannot be registered."

    Thanks.

  6. #6
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: [Exception] Class not registered

    Well in that case it's not a COM library. I don't think I can help you then, sorry

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width