Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / September 2004

Tip: Looking for answers? Try searching our database.

Application Restart or Reload Urgent....

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chris Calhoun - 27 Sep 2004 18:02 GMT
Does anyone know how to restart an application from itself? Or is there a
way to completely reload an application form code simulating a restart?

Thanks in Advance!
Sahil Malik - 27 Sep 2004 20:05 GMT
If you've written your app in VB.NET it might need a slight rewrite to match
a C# application style. But if you've written it in C#, you can put a try
catch around the
Application.Run(new Form1());

Portion, and basically in the catch do whatever recovery you want and recall
the above.

- Sahil Malik
You can reach me thru my blog at
http://www.dotnetjunkies.com/weblog/sahilmalik

> Does anyone know how to restart an application from itself? Or is there a
> way to completely reload an application form code simulating a restart?
>
> Thanks in Advance!
Justin Rogers - 27 Sep 2004 22:08 GMT
Note reloading your form only simulates a restart, and it doesn't carry with it
all of the features of an actual process restart. If you truly need to restart
your
application, then you should probably take a good hard look at Process.Start
and the Environment class. You'll be able to get the arguments your application
was started with and pass those to a new instance of your app.

If you need synchronization between unloading/loading, you can use a Mutex
to allow your existing application to shut down and release resources required
for the second instance to completely load. A great example would be a
listening port, since two apps can't share that sort of resource.

Signature

Justin Rogers
DigiTec Web Consultants, LLC.
Blog: http://weblogs.asp.net/justin_rogers

> If you've written your app in VB.NET it might need a slight rewrite to match
> a C# application style. But if you've written it in C#, you can put a try
[quoted text clipped - 12 lines]
>>
>> Thanks in Advance!

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.