Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hello,

My application is written in VB.NET 2008, and I want to catch CantStartSingleInstanceException exception.

I have read the following links:

http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.applicationservices.cantstartsingleinstanceexception(VS.80).aspx

http://msdn.microsoft.com/en-us/library/ms127539.aspx

http://forums.msdn.microsoft.com/en/csharplanguage/thread/3cd5bd24-f409-4779-8d72-73aa5d452967/

But cannot find how to catch this exception.

Anyone knows?

Posted

Hope the following code snippet should be helpful for you. I believe you should be able to add this snippet appropriately to your code.

Imports Microsoft.VisualBasic.ApplicationServices

Namespace My

   ...

   Partial Friend Class MyApplication

       Private Sub MyApplication_CantStartSingleInstanceException(ByVal sender As Object, _

           ByVal e As StartupNextInstanceEventArgs) Handles Me.StartupNextInstance

           ' Take Necessary Action

           MessageBox.Show("Single Instance Only")

       End Sub

   End Class

   ...

End Namespace

Don't ask what your country can do for you, ask what you can do for your country...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...