0
我有一個看起來工作正常的小型VB項目,除非我在某個函數中顯示任何表單。當程序執行結束時導致VB進程不能結束的形式
在下面的代碼中,顯示了form_progress
(稍後在函數中隱藏),但是當執行時(所有表單都關閉),進程並沒有結束,並且通常我被困在調試中,除非我手動結束它。請注意,如果我註釋掉form_progress.Show()
,則在所有表單關閉後,該過程將按預期結束。
起初我主要關注form_progress
表單的問題,但它不是 - 我在此處顯示的任何表單都會導致此問題。沒有錯誤被拋出,所以我迷失在哪裏看。如果有人有任何建議,我會appriciate它。謝謝。
Public Sub complete_action(folder As String, rename As Boolean, include_sub_folders As Boolean)
Dim dir As DirectoryInfo ' The directory that they user selected as an object
Dim output As String ' The output to be placed in the log
' Set 'output' to be an empty string (to avoid errors)
output = ""
Try
form_progress.Show()
' Set the DirectoryInfo object from the users selected directory name
dir = New DirectoryInfo(folder)
If include_sub_folders Then
output = recursive_loop(dir, rename, output)
Else
output = loop_folder(dir, folder, rename)
End If
' Write the log file
write_text.Log_File.write_to_file(output)
form_progress.Hide()
Catch oError As Exception
functions.error_handler(oError, "Error when looping through files", "complete_action")
End Try
End Sub
當然,謝謝。我完全是盲目的,因爲我關注的是形式被視爲問題的原因! – 2013-03-03 12:21:40