Click here to Skip to main content
15,909,205 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: VB.NET Progress status while run a EXE file Pin
Dave Kreskowiak24-May-11 4:31
mveDave Kreskowiak24-May-11 4:31 
AnswerRe: VB.NET Progress status while run a EXE file Pin
Luc Pattyn24-May-11 4:37
sitebuilderLuc Pattyn24-May-11 4:37 
GeneralRe: VB.NET Progress status while run a EXE file Pin
Andraw Tang24-May-11 5:10
Andraw Tang24-May-11 5:10 
GeneralRe: VB.NET Progress status while run a EXE file Pin
Andraw Tang24-May-11 6:52
Andraw Tang24-May-11 6:52 
AnswerRe: VB.NET Progress status while run a EXE file Pin
Luc Pattyn24-May-11 7:05
sitebuilderLuc Pattyn24-May-11 7:05 
GeneralRe: VB.NET Progress status while run a EXE file Pin
Andraw Tang24-May-11 7:24
Andraw Tang24-May-11 7:24 
Answerthere probably is a mistake somewhere Pin
Luc Pattyn24-May-11 7:42
sitebuilderLuc Pattyn24-May-11 7:42 
GeneralRe: there probably is a mistake somewhere [modified] Pin
Andraw Tang24-May-11 8:13
Andraw Tang24-May-11 8:13 
I thought I already give all the information needed.

The Run_Tool() will be called when user click "Run" item in the menu.

Inside Run_Tool(), a process will be created to run an exe file, at the same time, a form with progress bar will be created and displayed (let's forget about the progress bar value at this time), I also add an event Exited for the procee, when the event is called, close the form with progress bar, that's it.

Now the problem is that the Exited event is never called, so form progBarFrm is never closed.

 Dim progBarFrm as FormProgressBar

 Private Sub OnProcesited(ByVal sender As Object, ByVal e As System.EventArgs)
    Dim p As System.Diagnostics.Process
    p = sender

    progBarFrm.Close()
    progBarFrm.Dispose()


End Sub


Private Sub Run_Tool()

    Dim sAppPath As String = ".\XXXX.exe"
    Dim fileName As String = "DDDDDDDDDDDDDDDD.txt"
    Dim p As New System.Diagnostics.Process()



    p.StartInfo.FileName = Application.StartupPath & "\" & sAppPath
    p.StartInfo.Arguments = fileName

    'Do not use the system shell to start the program this is so we can hide the command dos window
    p.StartInfo.UseShellExecute = False
    p.StartInfo.WorkingDirectory = strOutputFilePath
    ' Show no dos window if false
    p.StartInfo.CreateNoWindow = True
    p.StartInfo.RedirectStandardOutput = True
    p.EnableRaisingEvents = True
    AddHandler p.Exited, AddressOf OnProcesited


    progBarFrm = New FormProgressBar

    Try
        p.Start()

        progBarFrm.Show()
        progBarFrm.Refresh()

    Catch ex As Exception
        ShowValidationMessage("Unexception error is caught, please close and try again.", "Error")
        'p.Kill()
        Return
    End Try




    ''Shell(sAppPath, vbNormalFocus) 'other options for starting with

End Sub


modified on Tuesday, May 24, 2011 2:21 PM

GeneralRe: there probably is a mistake somewhere Pin
Luc Pattyn24-May-11 8:38
sitebuilderLuc Pattyn24-May-11 8:38 
GeneralRe: there probably is a mistake somewhere Pin
Andraw Tang24-May-11 9:01
Andraw Tang24-May-11 9:01 
GeneralRe: there probably is a mistake somewhere Pin
Dave Kreskowiak24-May-11 8:41
mveDave Kreskowiak24-May-11 8:41 
GeneralRe: there probably is a mistake somewhere Pin
Andraw Tang24-May-11 9:04
Andraw Tang24-May-11 9:04 
GeneralRe: there probably is a mistake somewhere Pin
Andraw Tang24-May-11 8:45
Andraw Tang24-May-11 8:45 
GeneralRe: there probably is a mistake somewhere Pin
Dave Kreskowiak24-May-11 8:51
mveDave Kreskowiak24-May-11 8:51 
GeneralRe: there probably is a mistake somewhere Pin
Andraw Tang24-May-11 9:27
Andraw Tang24-May-11 9:27 
GeneralRe: there probably is a mistake somewhere Pin
Dave Kreskowiak24-May-11 9:49
mveDave Kreskowiak24-May-11 9:49 
GeneralRe: there probably is a mistake somewhere Pin
Andraw Tang24-May-11 9:41
Andraw Tang24-May-11 9:41 
GeneralRe: there probably is a mistake somewhere Pin
Dave Kreskowiak24-May-11 9:51
mveDave Kreskowiak24-May-11 9:51 
GeneralRe: there probably is a mistake somewhere Pin
Andraw Tang24-May-11 12:13
Andraw Tang24-May-11 12:13 
GeneralRe: there probably is a mistake somewhere Pin
Dave Kreskowiak24-May-11 12:26
mveDave Kreskowiak24-May-11 12:26 
QuestionVB.NET Handle SQL DB in Multi user application Pin
All Time Programming23-May-11 20:44
All Time Programming23-May-11 20:44 
AnswerRe: VB.NET Handle SQL DB in Multi user application Pin
AspDotNetDev23-May-11 22:01
protectorAspDotNetDev23-May-11 22:01 
GeneralRe: VB.NET Handle SQL DB in Multi user application Pin
All Time Programming23-May-11 22:34
All Time Programming23-May-11 22:34 
GeneralRe: VB.NET Handle SQL DB in Multi user application Pin
Thomas Krojer23-May-11 23:13
Thomas Krojer23-May-11 23:13 
GeneralRe: VB.NET Handle SQL DB in Multi user application Pin
Dave Kreskowiak24-May-11 1:21
mveDave Kreskowiak24-May-11 1:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.