Results 1 to 4 of 4

Thread: App.PrevInstance [resolved]

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    App.PrevInstance [resolved]

    OK, I have 2 forms, the main one I want it to show only once, and the other as many times as you run the program, but it always showing either one or the other (in the same instance).

    The problem with the next code is that when I run the program with a command i.e. the frmRestore is showing, the next time I run the program without the command, the main form does not show up, and I want it to because there is no previous instance of the main form.
    If I do it the other way around, then it works. If I close all instances of my program, run it without a command, then run it with a command, then it works.... get it ?
    VB Code:
    1. Private Sub Form_Load()
    2.     If Command <> "" Then
    3.         Load frmRestore
    4.         Unload Me
    5.         Exit Sub
    6.     End If
    7.    
    8.     If App.PrevInstance Then End
    9. End Sub
    Reading what I wrote, it still seems a bit confuzing. I'll try another way...
    So... I have 2 forms, main form and frmRestore, when I run the program more than once, I want the main form to show only once, but the frmRestore more than once, and it should not matter in witch order I run them, main form should always be once...
    Last edited by CVMichael; Jan 4th, 2004 at 02:21 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width