Hello everybody,
I am getting following exception while opening a form in a separate thread.
Exception throws on following line in InitializeComponent() method.Code:An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in system.windows.forms.dll Additional information: Class not registered
Here is the code for sending methods on thread.Code:this.Load += new System.EventHandler(this.frm_DesingTemplate_Load); ((System.ComponentModel.ISupportInitialize)(this.axDrawingControl1)).EndInit();
Here is the method under which exception is thrown.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); } }
Exception is thrown in the InitializeComponent() of frm_DesingTemplate form. A visio drawing control has been used on this form.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(); }
Any ideas to resolve this issue ??
Thanks.




Reply With Quote