Results 1 to 2 of 2

Thread: Referencing Opener Form

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2006
    Posts
    589

    Referencing Opener Form

    Opening a form modally I am writing.

    CustomerForm.Show vbModal, me

    On CustomerForm - how do I reference the form that opened the CustomerForm?

    Thanks for any help

  2. #2
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: Referencing Opener Form

    Code:
    ' in customer form
    
    Dim m_ParentForm As Form
    
    Public Property Get ParentForm() As Form
        Set ParentForm = m_ParentForm
    End Property
    Public Sub ShowModal(Optional ByRef Parent As Form)
        Set m_ParentForm = Parent
        Me.Show vbModal, m_ParentForm
    End Sub
    And then you can use CustomerForm.ShowModal Me in the other forms to open it. The form will remember the parent and you could even check the latest parent from modules and classes by using CustomerForm.ParentForm.

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