Results 1 to 6 of 6

Thread: Return To Previous Form

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 1999
    Location
    Canton,Ohio,USA
    Posts
    2

    Question

    I am working on my first VB application for a friend with his own business. When the user enters an item (ie. part #, Customer, etc.)that is not in the database he is taken to the setup screen for that item. My problem is how to get him back to his original screen and location after the setup is complete. He may not always be in the same form when he has a need to setup a new item so the form I have to get back to may change.

  2. #2
    Addicted Member S@NSIS's Avatar
    Join Date
    Aug 2000
    Location
    Stoke-On-Trent, England
    Posts
    243
    Hi,
    Instead of completely swithcing forms to enter a new customers details, just show the setup screen as a modal form for the calling form. That way, once the setup is finished with it will automatically go back to screen that called it.
    example:
    Code:
    'say you have two forms and one set up form and either form can call the set up form
    
    'In form1 code where you need to show setup screen
    
    SetupScreen.Show vbModal,Form1
    
    'In form2 code where you need to show setup screen
    
    SetupScreen.Show vbModal,Form2
    
    'Once the set up screen is finished, you will go back to the calling form exactly where you left it
    Hope this helps

    Shaun
    Web/Application Developer
    VB6 Ent (SP5), Win 2000,SQL Server 2000

  3. #3
    Guest
    First, add this to the beginning of the module that opens the Setup Screen.

    Code:
    Public Declare Function GetActiveWindow Lib "user32" _
    Alias "GetActiveWindow" () As Long
    
    Public Declare Function SetForegroundWindow Lib "user32" _
    Alias "SetForegroundWindow" (ByVal hwnd As Long) As Long
    
    Public winact as Long
    Then, add this to the beginning of the procedure that opens the dialog:

    Code:
    winact = GetActiveWindow
    And add this to the end of setup program:

    Code:
    SetForegroundWindow winact
    Hope it helps.

  4. #4
    Guest
    S@NSIS:

    If you show the form as Modal, then no other forms can be on top of it. If you're a beginner and need to close a background window...

  5. #5
    Lively Member
    Join Date
    Sep 2000
    Posts
    116

    Exclamation FORM IN THE BACKGROUND, NOT ON TOP!

    Escaflowne,

    Is there a way to force a form to stay in the back
    instead of on top?!
    0101011001000010
    01101111011011100110110001101001011011100110010101110010

  6. #6
    Guest
    If they're all in the same Thread/App, use
    Code:
    Me.ZOrder 1

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