我的简单项目中出现错误.
这是我的代码:
if (axZKFPEngX1.InitEngine() == 0) {
label1.Text = "Connected";
}
else {
label1.Text = "Connection Failed";
}
Run Code Online (Sandbox Code Playgroud)
我已经添加了参考复合材料AxInterop.ZKFPEngXControl
和Interop.ZKFPEngXControl
.
在调试时,我单击按钮,会出现警告:
处理了InvalidActiveXStateException.
"类型'System.Windows.Forms.AxHost + InvalidActiveXStateException'的异常被抛出"**
我尝试添加一个 COM 控件。我采取的步骤:
1. 右键单击工具箱
2. 选择 COMComponents 选项卡,然后出现“Adobe PDF Reader”
3. 单击“确定”按钮
4. 现在尝试将 Adobe PDF Reader 控件拖放到 UserControl 中 --> 失败错误:
"Failed to create component 'AxHost'. The error message follows: 'System.Runtime.InteropServices.COMException (0x80004005): A wrapper assembly is not registrated for this type library.
at
System.Windows.Forms.Desgn.DocumentDesigner.AxToolboxItem.CreateComponentsCore(IDesignerHost host)
at
System.Drawing.Design.ToolboxItem.CreateComponentsCore(IDesignerHost host, IDictionary defaultValues)
at
System.Drawing.Design.ToolboxItem.CreateComponents(IDesignerHost host, IDictionary defaultValues)
at
System.Windows.Forms.Design.OleDragDropHandler.CreateTool(ToolboxItem tool, Control parent, Int32 x, Int32 y, Int32 width, Int32 heigth, Boolean hasLocation, Boolean hasSize, ToolboxSnapDragDropEventArgse)'"
我现在能做什么?
提前感谢每一位回答。
问候,乔
我正在尝试将 Windows Media Player 对象添加到我的 Windows 窗体中,但它弹出一个错误:
Failed to create compopnent 'AxHost'. The error message follows:
'System.Reflection.ReflectionTypeLoadException: Unable to load
one or more of the requested types. Retrieve the LoaderExceptions
property for more information.
at
System.Windows.Forms.Design.DocumentDesigner.AxToolboxItem.
CreateComponentsCore(IDesignerHost host)
at
System.Drawing.Design.ToolboxItem.CreateComponentsCore(IDesignerHost
host, IDictionary defaultValues)
at
System.Drawing.Design.ToolboxItem.CreateComponents(IDesignerHost
host, IDictionary defaultValues)
at
System.Windows.Forms.Design.OleDragDropHandler.CreateTool(ToolboxItem
tool, Control parent, int32 x, int32 width, int32
height, Boolean hasLocation, Boolean hasSize,
ToolboxSnapDragDropEventArgs e)'
Run Code Online (Sandbox Code Playgroud)
但是,如果我要创建一个新项目并添加 Windows Media Player,它就可以正常工作。
我在网上尝试了一些解决方案,例如在新项目(使用 Windows Media Player)打开时添加 Windows Media Player,将现有表单添加到项目等,但无济于事。
有什么我做错了吗?