Results 1 to 4 of 4

Thread: Calling other forms

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    14
    I have 4 forms, the main form has 3 command buttons, how do I call the other forms one at a time and have only one visible at a time. I just need the code to put behind the command button. I now it's basic but I have never needed it b4. Thanks

  2. #2
    Junior Member
    Join Date
    Mar 2000
    Posts
    19

    Simple (your gonna hit yourself after this)

    just do it like this

    Private Sub Command1_Click()
    Form1.Visible = False 'for every one you enable the
    Form2.Visible = True 'other three should be disabled
    Form3.Visible = False
    Form4.Visible = False
    End Sub

  3. #3
    Hyperactive Member
    Join Date
    Mar 2000
    Posts
    461
    Actually it might not be as simple as that.

    You can make forms visible and invisible but if that is the only thing you do then whatever was contained on those forms when you were last there remains.

    This means that if I was half way through entering into a text box then it would still be half entered when I went back to it.

    This may be fine if thats what you want... but sometimes you want to display the form "refreshed" as if it was the first time you have seen it.

    Also, by opening each of the forms (and remember that setting the Visible attribute causes it to LOAD if it isn't already) you actually have them ALL in memory and taking up space rather than only loading/unloading the one you want.

    You might also want to consider if you are making this MDIChildren which means the forms exist INSIDE the big form with the command buttons. In this sense you could make them minimized instead (kind of like when you minimize a document in word) so you can bring the others up if you want.

    Just something to consider

  4. #4

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    14

    Worked perfect thanks

    Worked perfect thanks. Quick response

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