我收到運行時錯誤「SensionVB.CommonCall的類型初始值設定項引發異常。」試圖實例化對象呼叫時:對象的類型初始值設定項引發異常
Dim general As New SensionVB.CommonCall
當單步調試代碼,一旦打在上面一行代碼和失敗,它的作用。
從微軟的建議是檢查null,或增加新的既不在這種情況下是真的
SensionVB =項目 CommonCall =公用類具有各種功能
Public Class CommonCall
Protected WithEvents litOne As System.Web.UI.WebControls.Literal
Public Shared sConnection As String = ConfigurationManager.ConnectionStrings("SerialStamperConnectionString").ConnectionString
Public Shared oConnection As New MySqlClient.MySqlConnection(sConnection)
Public Shared sMaxSerialNumber As String = "S000001"
Public Shared bLoggedin As Boolean = False
Public Shared iPageWidth As Integer = 1024
Public Shared isValidPassword As Boolean = False
Public Shared strCompanyID As String = ""
Public Shared strSecurityID As String = ""
Dim Response As New HttpResponse(HttpWriter.Null)
Const TimeOutInMinutes As Integer = 60
Const SiteTitle As String = "SensiOn"
Public Const PageWidth As Integer = 1250
Public SSOenabled As Boolean
Const SuperUserEmails As String = "[email protected]"
Public Sub Initialize()
oConnection.Open()
End Sub
看看內部異常。 – SLaks
未將對象引用設置爲對象的實例。 – Sean
請顯示CommonCall類的靜態構造函數('Shared Sub New')的代碼 – jeroenh