How do I avoid opening multiple instances of same application.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abhiab54
    New Member
    • Jan 2007
    • 10

    How do I avoid opening multiple instances of same application.

    Hi all,
    I am facing a problem in VB. As many times i clicked on application created in VB, that many times it get opened. I want at one time only one instance of application should get opened & excecuted.
  • iburyak
    Recognized Expert Top Contributor
    • Nov 2006
    • 1016

    #2
    Try this at a start up before any code executed.

    [PHP]
    If App.PrevInstanc e Then
    AppActivate App.ProductName
    End
    End If[/PHP]

    It should bring up front already running instance and close this one.

    Comment

    • Hemant Pathak
      Recognized Expert New Member
      • Jul 2006
      • 92

      #3
      if app.Instance then
      exit sub
      end if

      Comment

      • abhiab54
        New Member
        • Jan 2007
        • 10

        #4
        Thanks everybody. Code is working fine.

        Comment

        Working...