所以這是我在一個模塊的函數中的代碼。我想關閉該程序,我撥打Application.Exit
,但它仍在運行。這是否有充分的理由?vb.net程序不關閉
Dim OpenFileDialog1 As New FolderBrowserDialog
If OpenFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
pictureFolder = OpenFileDialog1.SelectedPath
movingPictures(pictureFolder)
'GetImagePath()
Else
Dim answer As DialogResult
answer = MessageBox.Show("The Program needs this folder to continue, " & vbCrLf & _
"Choose Retry to try again, or Cancel to close.", "Retry or Close?", MessageBoxButtons.RetryCancel, MessageBoxIcon.Information)
If answer = vbRetry Then
GoTo RepickOpenfileDialog
Else
' essentially ... here is where I'd like to close the program ...
' but it simply won't... it keeps running though the code...
' there a good reason for that ?
Application.Exit()
Form1.Close()
End If
End If
processLock = 0
您確定您的代碼實際上是跟隨Application.Exit調用的路徑嗎?當你使用調試器時你是否碰到了Application.Exit行?這將是最明顯的問題。 – 2013-05-02 17:41:41
是的,我走過它,它繼續運行我的代碼 - 幾乎200行代碼之前,我喜歡 - 並且停止調試 – Pakk 2013-05-02 17:51:46
爲什麼你從一個模塊開始? movePictures()會發生什麼? movingPictures中有**循環**嗎?您發佈的代碼如何再次觸發? – 2013-05-02 17:55:58