0

I can’t find a way to get the Application.Restart() to work after clicking out of the MessageBox, it seems to close the existing instance but doesn’t start a new instance. I can get it to perform pretty much anything else I put in there (another messagebox.show(), show another form, etc ). This is a single instance app and I don’t seem to have any trouble on the other button in my app that performs Application.Restart(). If there’s a better way to go than Application.Restart(), I’d go for it, but it seems like every alternative I’ve tried from other threads does the same thing, exit and not start a new one.

Dim result As DialogResult
MessageBox.Show( _
"Server is busy.  Please try again.", _
"Program", _
MessageBoxButtons.OK, _
MessageBoxIcon.Exclamation)

 If result = 0 Then

     Application.Restart()

 End If
Evi1M4chine
  • 6,992
  • 1
  • 24
  • 18
  • a) you arent assigning the result of that MessageBox to result b) if they do hit OK, the value is 1 not 0 c) since it is Modal why do you have to check anything? The user does not appear to have a choice. d) cant the app wait a while and try again rather than immediately restart and presumably retry? – Ňɏssa Pøngjǣrdenlarp Dec 03 '16 at 00:07
  • http://stackoverflow.com/questions/779405/how-do-i-restart-my-c-sharp-winform-application – Hadi Dec 03 '16 at 00:57

0 Answers0