C# Runtime System.InvalidCastException

-1

I'm running a C# Application compiled using visual studio. It get compiled without any error, however at runtime I'm getting following error.

enter image description here

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'MSComctlLib.Toolbar'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{66833FE4-8583-11D1-B16A-00C0F0283628}' failed due to the following error: Interface not registered (Exception from HRESULT: 0x80040155).
   at CallSite.Target(Closure , CallSite , Object )
   at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
   at myproj.Form1.ReplaceMem(Document objDoc, InlineShape[] ocx) in C:\Users\Jhon\documents\visual studio 2015\Projects\myproj\myproj\Form1.cs:line 138
   at myproj.Form1.button1_Click(Object sender, EventArgs e) in C:\Users\Jhon\documents\visual studio 2015\Projects\myproj\myproj\Form1.cs:line 157
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Can anyone please suggest, what shall I do to fix this problem ?

TIA

c#
.net
com
asked on Stack Overflow Mar 27, 2017 by Dev.K.

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0