
Manipulate 'parent' forms
Assuming you are using VB4 or later, you can create a public Sub in the
detail form, and pass the "parent" form object to it as a parameter. You can
also pass the ItemNumber as a parameter instead of using the Tag property.
Example:
' in form MAInfo
Public Sub ShowDetail (frmParent As Form, ByVal ItemNumber as Integer)
' store parameters as module level variables
Set mfrmParent = frmParent
mItemNumber = ItemNumber
' show this form
Show
' whatever else need doing
End Sub
To communicate back to the parent, just do
mfrmParent.Data1.Event
Oh yes, and instead of Load'ing and Show'ing the child, call it's ShowDetail
method:
Dim MADetail1 As New MAInfo
MADetail1.ShowDetail Me, ItemNumber
-Andy.
Quote:
>I have an app that shows a list of items in a grid. A procedure then create
an instance of a form to show details of that item. the item number is
Quote:
>passed via the .tag property:
> Dim MADetail1 As New MAInfo
> MADetail1.Tag = ItemNumber
> Load MADetail1
> MADetail1.Show
>That can happen again
> Dim MADetail2 As New MAInfo
> MADetail2.Tag = ItemNumber
> Load MADetail2
> MADetail2.Show
>That form again can create a new instance of another form to display a list
of information on that item, and most important, manipulate a data control
Quote:
>on the calling form. How can I pass information to the subform that allows
me to do something like
Quote:
> MADetailx.Data1.Refresh
> MADetailx.Grid1.ReBind
> MADetailx.SetFocus
>and pass control back to MADetailx after unloading? I could pass the name
of the calling Form via .Tag, but what sort of var do I have to Dim in the
Quote:
>subsubform to use it for manipulating the 'parent'
>Dim ParentName as ??????
>(Set) ParentName = Me.Tag
>ParentName.Data1.Event
>Any sort of help or hints where to look greatly appreciated!
>Christoph Niessen