473,383 Members | 1,789 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Kill and restart the same application through code

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 -

Expand|Select|Wrap|Line Numbers
  1. If myflag = false Then 
  2.    Dim p As New System.Diagnostics.ProcessStartInfo()
  3.    p.FileName = """" & My.Application.Info.DirectoryPath & "\" &   My.Application.Info.AssemblyName & ".exe" & """"
  4.    p.WindowStyle = ProcessWindowStyle.Normal
  5.    p.Verb = "open"
  6.    p.UseShellExecute = True
  7.    Dim myprocess As New System.Diagnostics.Process
  8.    Me.Dispose()
  9.    myprocess.Start(p)
  10.    myprocess.WaitForExit()
  11.  
  12. 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 ...
Feb 15 '07 #1
1 1515
kenobewan
4,871 Expert 4TB
Maybe when the application reopens myflag is (still) set to false?
Feb 17 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: bie2 | last post by:
Hi, Here's what I want to do: 1. Start the application. 2. A SplashScreen running in its own thread is started. 3. I'm checking if the application needs an update. 4. If an update is needed...
3
by: John A Grandy | last post by:
In ASP.NET 1.1 and/or 2.0 ..... Is it possible to configure a web-app so that replacement of an .xml file ( physically located under the virtual dir root ) with a newer version of the file...
3
by: MarkusJNZ | last post by:
Hi, I have two different applications running on 2003 both in two different vitrual directories. One application runs on the .NET framework 1.1 whilst the other runs on 2.0. If I change the...
10
by: fadel daher | last post by:
i am building an application to monitor servers. i have written code that gets me all running processes on remote server, but i cant manage to get a code to kill a remote process . can any one...
4
by: yxq | last post by:
Hello, I want to kill the Explorer process, after Explorer process has been killed, it will restart automatically immediately. How to disable it restart automatically? for example, in Windows Task...
18
by: =?Utf-8?B?VGhlU2lsdmVySGFtbWVy?= | last post by:
Because C# has no native SSH class, I am using SharpSSH. Sometimes, for reasons I do not know, a Connect call will totally lock up the thread and never return. I am sure it has something to do...
2
by: =?Utf-8?B?WVhR?= | last post by:
Hello, In the parent process(A), run update function, and start the update process(B), in B process, kill A, then download and update files, then restart A. I want to know can the B process kill...
0
by: Almund | last post by:
Hi, Since a while back PosgreSQL have started to hang making interaction with it impossible. The process still remains in the taskmanager aswell as another process with the same name (which i guess...
1
by: beyrself | last post by:
Public Function RsReDir() 'function to restart dns redirector - working as of 12-11-08' Dim plist As Process() = Process.GetProcesses() 'Get and parse list of processes to plist' For Each p As...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.