Results 1 to 8 of 8

Thread: Showing Forms

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2004
    Posts
    33

    Showing Forms

    Hi,

    I'm having a problem with opening two forms at once; when I open 1 form using vbmodal, the other form opened at the same time cannot be accessed. How can I overcome this?

    Thanks

  2. #2
    Lively Member sishe's Avatar
    Join Date
    Aug 2004
    Location
    Izmit/Turkey
    Posts
    115

    Re: Showing Forms

    That is the usage of modal forms. If you make a form modal, any other form that belongs to the application can be accessed.

    If you want to access two forms together, do not use vbModal.

    Try to use MDI forms for accessing multiple forms.
    System Halted..
    -----------------------------------------
    Sishe

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2004
    Posts
    33

    Re: Showing Forms

    I've never used an MDI Form and don't know what one is either.

    Basically, I have three forms; one parent form, two child forms. What I want is that when the two child forms are opened from the parent form, the parent form becomes inaccessible (but still visible).

    Thanks.

    By the way: I already have the three forms created.

  4. #4
    Lively Member sishe's Avatar
    Join Date
    Aug 2004
    Location
    Izmit/Turkey
    Posts
    115

    Re: Showing Forms

    Assuming that you have 3 forms named Form1, Form2 and Form3. Lets say Form1 is the main form and has two buttons on it, Command1 and Command2.

    Form1 Code;
    VB Code:
    1. Option Explicit
    2.  
    3. Public m_bForm2Opened As Boolean
    4. Public m_bForm3Opened As Boolean
    5.  
    6. Private Sub Command1_Click()
    7.  
    8.     If Not m_bForm2Opened Then Form2.Show
    9.    
    10. End Sub
    11.  
    12. Private Sub Command2_Click()
    13.  
    14.     If Not m_bForm3Opened Then Form3.Show
    15.    
    16. End Sub
    17.  
    18. Private Sub Form_Activate()
    19.  
    20.     If m_bForm2Opened And m_bForm3Opened Then Form2.SetFocus
    21.  
    22. End Sub
    23.  
    24. Private Sub Form_Load()
    25.  
    26.     m_bForm2Opened = False
    27.     m_bForm3Opened = False
    28.  
    29. End Sub

    Form2 Code;
    VB Code:
    1. Private Sub Form_Load()
    2.  
    3.     Form1.m_bForm2Opened = True
    4.    
    5. End Sub
    6.  
    7. Private Sub Form_Unload(Cancel As Integer)
    8.  
    9.     Form1.m_bForm2Opened = False
    10.    
    11. End Sub

    and Form3 Code;
    VB Code:
    1. Private Sub Form_Load()
    2.  
    3.     Form1.m_bForm3Opened = True
    4.    
    5. End Sub
    6.  
    7. Private Sub Form_Unload(Cancel As Integer)
    8.  
    9.     Form1.m_bForm3Opened = False
    10.    
    11. End Sub

    About MDI Forms follow the Link
    System Halted..
    -----------------------------------------
    Sishe

  5. #5
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Showing Forms

    A MDI form is like MS Word. Each document is a MDI child that opens in the parent. You can have many children in the parent, but when the parent closes, the children should also.

  6. #6

    Thread Starter
    Member
    Join Date
    Oct 2004
    Posts
    33

    Re: Showing Forms

    Thanks all

  7. #7

  8. #8
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Showing Forms

    I remember something like that. The children don't close automatically, or something like that?

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