Hi,
Can someone help, after all process finish, it should show the message box and it's not...
Code:Public Class InstallPrograms Dim pCount As Integer Dim p() As Process Sub InstallPrograms_KeyUp(ByVal sender As Object, ByVal e As KeyEventArgs) Handles MyBase.KeyUp If e.KeyData = Keys.F1 Then Editor.ShowDialog() End If End Sub Private Sub InstallPrograms_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.Show() 'Me.Text = "Post Install By Chris2k" + SelectPrograms.ver For Each App As ListViewItem In SelectPrograms.App_List.CheckedItems Label3.Text = "Installing " + App.SubItems(0).Text Label3.Refresh() Label5.Refresh() Dim File As New System.Diagnostics.ProcessStartInfo File.FileName = App.SubItems(3).Text Dim Installer As New System.Diagnostics.Process Installer.StartInfo = File Installer.Start() 'Start the process Installer.WaitForExit() 'Wait until the process started is finished Installer.Close() 'Release the resources Label5.Text = "Install Complete..." Label5.Refresh() System.Threading.Thread.Sleep(750) Label5.Text = "" Label5.Refresh() Next ' We'll assume you have all the filepaths in a listbox ' it would work the same for any other collection type pCount = SelectPrograms.App_List.CheckedItems.Count ReDim p(pCount - 1) For i = 0 To pCount - 1 p(i) = New Process With {.EnableRaisingEvents = True} AddHandler p(i).Exited, AddressOf ProcessExit p(i).StartInfo.FileName = SelectPrograms.App_List.Items(i).SubItems(3).Text 'p(i).Start() Next End Sub Private Sub ProcessExit(ByVal sender As Object, ByVal e As System.EventArgs) pCount -= 1 If pCount = 0 Then MsgBox("All Done") End If End Sub End Class




Reply With Quote