我有一些代碼來保存日誌我的FormClosing事件工作正常,直到我添加代碼來創建一個目錄,如果它不存在這樣的目錄。Winform沒有關閉爲什麼?
現在如果我添加註釋行應用程序不關閉。
我不明白爲什麼。
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
TmrReporte.Stop()
WriteRTBLog("Finalizacion del programa. - Version " & Me.ProductVersion, Color.Blue)
Dim Fecha As String
Fecha = Now.ToShortDateString & "-" & Now.ToLongTimeString
Fecha = Fecha.Replace("/", "")
Fecha = Fecha.Replace(":", "")
Dim PathArchivo As String = Application.StartupPath & "\Logs\" & Fecha & ".logout"
'If (Not System.IO.Directory.Exists(PathArchivo)) Then
' System.IO.Directory.CreateDirectory(PathArchivo)
'End If
RTB_Log.SaveFile(PathArchivo, System.Windows.Forms.RichTextBoxStreamType.RichText)
End Sub
大概一個異常被拋出 –
與
logout
擴展名的文件路徑http://stackoverflow.com/questions/4933958/vs2010-does-not-show-unhandled-ex ception-message-in-a-winforms-application-on-a –@HansPassant所以在Windows x32中,我會得到一個錯誤,但在Windows x64上卻不行?有趣。 –