我有一些代码来保存日志我的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上却不行?有趣。 –