错误'TimeandAttendanceSystem.Module1'的类型初始值设定项引发了异常. [英] error The type initializer for 'TimeandAttendanceSystem.Module1' threw an exception.

查看:95
本文介绍了错误'TimeandAttendanceSystem.Module1'的类型初始值设定项引发了异常.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我需要您的帮助,
我正在将vb应用程序转换为vb.net 2005,

它会产生很多错误,
我修复了所有错误,
但我仍然遇到问题,
加载表单时会出现错误,


"TimeandAttendanceSystem.Module1"的类型初始值设定项引发了异常.

当我单击查看详细信息"时
{"TimeandAttendanceSystem.Module1"的类型初始值设定项引发异常."}-{"TimeandAttendanceSystem.Module1"的类型初始值设定项引发异常."}

内部异常-{由于以下错误,未能为具有CLSID {C58A8F87-CAA0-11D8-8486-0050BA8CA867}的组件检索COM类工厂:80040154."}

hi experts,i need yr help guys,
I am converting vb application to vb.net 2005,

It generates lots of error,
i fixed the all error,
but still i am getting the problem,
at the time of form loading it gives the error,

ie
The type initializer for ''TimeandAttendanceSystem.Module1'' threw an exception.

when i click on "View Detail"
{"The type initializer for ''TimeandAttendanceSystem.Module1'' threw an exception."} - {"The type initializer for ''TimeandAttendanceSystem.Module1'' threw an exception."}

Inner exception - {"Retrieving the COM class factory for component with CLSID {C58A8F87-CAA0-11D8-8486-0050BA8CA867} failed due to the following error: 80040154."}

推荐答案

abhishek1singh@rediffmail.com写道:
abhishek1singh@rediffmail.com wrote:

内部异常-{为具有CLSID的组件获取COM类工厂{C58A8F87-CAA0-11D8 -8486-0050BA8CA867}由于以下错误而失败:80040154.}

Inner exception - {"Retrieving the COM class factory for component with CLSID {C58A8F87-CAA0-11D8-8486-0050BA8CA867} failed due to the following error: 80040154."}



这意味着您正在使用一个COM组件,它要么未注册,要么无法启动.



This means you''re using a COM component and it''s either not registered, or it''s failing to start.


如果您不知道要注册哪个COM对象,人们不得不怀疑您怎么知道自己在做什么.它是您的组件,您正在使用它.您可以在控制台窗口中使用regsvr32进行注册,后跟文件的路径.

添加引用可能需要注册该引用,在这种情况下,您需要阅读该对象的文档,以查看您做错了什么.此组件是否具有某种类型的UI?干净的转换会将您替换为您自己的代码,VB6经常使用COM对象,因为它很垃圾.

您可能还需要为应用程序指定线程模型,以使其全部正常工作.
If you have no idea what COM object to register, one has to wonder how you know what you''re doing at all. It''s your component, you are using it. You register it with regsvr32 followed by the path to the file, in the console window.

Adding a reference probably requires it to be registered, in which case, what you need is to read the documentation for the object, to see what you are doing wrong. Does this component have any sort of UI ? A clean conversion would have you replace this with your own code, VB6 just used COM objects a lot because it was rubbish.

you may also need to specify the threading model for the app in order to make it all work.


如果您使用的是随机DLL并且不知道它来自何处,那么也许您唯一的选择就是抛弃它并重写功能.在任何情况下,都可能希望创建兼容VB6的表单,并且无法在托管环境中工作.
If you''re using a random DLL and have no idea where it came from, then probably your only choice is to just ditch it and rewrite the functionality. It''s possible in any case that it''s expecting to create VB6 compatible forms and it''s not working in a managed environment.


这篇关于错误'TimeandAttendanceSystem.Module1'的类型初始值设定项引发了异常.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆