Tag: typeinitializeexception

System.TypeInitializationException对Class的FORM访问

我正在一个项目,我需要调用一个类,我创build和pipe理一个Excel文件。 但是对于未定义的原因,我不能从我的FORM中调用这个函数。 它返回一个exception,如下所示:System.TypeInitializationException。 我已经检查了我的class级,但是我没有看到什么是错的。 我想要调用我的Excel_Management类的表单: Imports System.Diagnostics Imports System.Windows.Forms Public Class Proc_Form Private excel_Manage = New Excel_Management Public Shared ok As Boolean = New Boolean If My.Settings.check_Directory = False Then If FolderBrowserDialog1.ShowDialog = DialogResult.OK Then My.Settings.path = FolderBrowserDialog1.SelectedPath My.Settings.check_Directory = True 'My.Settings.Save() MsgBox(My.Settings.path) excel_Manage.check_Excel() End If Excel_Management类: Imports Microsoft.Office.Interop Imports Microsoft.Office.Interop.Excel Imports System.Windows.Forms Imports System.Text.RegularExpressions […]