|
-
Sep 29th, 2005, 08:22 AM
#1
Thread Starter
Frenzied Member
[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.
-
Sep 29th, 2005, 06:32 PM
#2
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?
-
Sep 29th, 2005, 11:36 PM
#3
Thread Starter
Frenzied Member
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.
-
Sep 29th, 2005, 11:36 PM
#4
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.
-
Sep 30th, 2005, 12:48 AM
#5
Thread Starter
Frenzied Member
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.
-
Oct 1st, 2005, 02:14 AM
#6
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|