所以这是我在一个模块的函数中的代码。我想关闭该程序,我拨打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