Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Parent form


Message #1 by John Walborn <JWalborn@m...> on Thu, 25 Jan 2001 10:22:58 -0700
John,
 
    There is no built in way that I know of to do what
you ask.  I do have a suggestion through for a work
around.  In VB, forms are considered the same as 
classes which can contain custom properties
and methods.  So you can code a custom 
method for the form to which you pass the
current form name.  Here is an example of code
you would add to your sub form:
 
-----Begin SubForm Code------
 
Dim ParentForm as Form
 
Public Sub SpecialShow(MyForm As Form)
    Set ParentForm = MyForm
    Me.Show 1
End Sub

-----Begin End SubForm Code------
 
In your parent form you would call it this way:
 
-----Begin ParentForm Code-----
 
Private Sub Command1_Click()
      Form2.SpecialShow Me
End Sub
 
-----End ParentForm Code-----
 
Hope this helps.  Let me know if this is
what you need.  Otherwise I can suggest
some other things as well.
 
Cardyin
 
-------------------------------------- 
Cardyin Kim 
System Analyst - Information Services 
San Antonio Community Hospital 
ckim@s...     (xxx)xxx-xxxx     
-------------------------------------- 
 

-----Original Message-----
From: John Walborn [mailto:JWalborn@m...]
Sent: Thursday, January 25, 2001 9:23 AM
To: professional vb
Subject: [pro_vb] Parent form



All,
 
How can I reference a "parent" form? Let me give you some context...
 
Multiple forms can load a single subform for multiple purposes. Subform
needs to extract a value from the "parent", not knowing what the "parent"
form is.
 
Any suggestions? I do not wish to use MDI.
 
Thanks! 


  Return to Index