Hi!
For a certain requirement, I need to kill the current application and restart the same application again. For that, I have the follofing code in the form-closing event of the application -
this does work as required, but every time the application reopens, an error message also appears saying - "myapplication. exe has encountered a problem and needs to close. We are sorry for the inconvenience. If you were in the middle of something, the information you were working on might be lost."
any help would be greatly appreciated.
thank you ...
For a certain requirement, I need to kill the current application and restart the same application again. For that, I have the follofing code in the form-closing event of the application -
Code:
If myflag = false Then Dim p As New System.Diagnostics.ProcessStartInfo() p.FileName = """" & My.Application.Info.DirectoryPath & "\" & My.Application.Info.AssemblyName & ".exe" & """" p.WindowStyle = ProcessWindowStyle.Normal p.Verb = "open" p.UseShellExecute = True Dim myprocess As New System.Diagnostics.Process Me.Dispose() myprocess.Start(p) myprocess.WaitForExit() End If
this does work as required, but every time the application reopens, an error message also appears saying - "myapplication. exe has encountered a problem and needs to close. We are sorry for the inconvenience. If you were in the middle of something, the information you were working on might be lost."
any help would be greatly appreciated.
thank you ...
Comment