When I've tried these suggestions, other forms weren't able to access
my 'CustomerData' form. So here's what I came up with in case anybody
cares or wants to do the same thing:
'Find the correct frmCustomers that opened this form and update the
grid
For X = 0 To (frmMain.MdiChildren.Length) - 1
Dim tempChild As Form = CType(frmMain.MdiChildren(X),
Form)
If tempChild.Name = "frmCustomers" Then
Dim CallingForm As frmCustomers =
DirectCast(tempChild, frmCustomers)
If CallingForm.txtCourseID.Text = Me.txtCourseID.Text
Then
CallingForm.LoadChkbox()
'Locate the updated record in the Grid1
For Y = 0 To CallingForm.Grid1.Rows.Count - 1
If CallingForm.Grid1.Rows(Y).Cells(0).Value =
txtCustomerNumber.Text Then
CallingForm.Grid1.CurrentCell =
CallingForm.Grid1.Rows(Y).Cells(1)
Exit For
End If
Next Y
Me.Close()
CallingForm.Show()
CallingForm.Grid1.Focus()
Exit For
End If
End If
Next X
When I open the CustomerData form, I fill a textbox with the customer
number on both forms. I then look for that customer number in the
textbox on all frmCustomers. It works.
On 28 Sep 2006 15:05:58 -0700, "Sca_Tone" <sw**********@hotmail.com>
wrote:
>Hi Kevin,
You would add code that works in the same way the MDIParent calls
the ChildForm.
eg.
Dim frmChild as New frmCustomers
frmChild.MdiParent = Me
frmChild.Show()
>>From the code above you now have an MDIParent with a linked Child as
you orginally stated.
Then you state you call another form from the child to amend customer
data.
eg.
Dim frmNewForm as new frmCustomerData
frmNewForm.Show()
**** THE FIX ****
In the customer data form you load from the child, you need to add a
'/ ADD TO CUSTOMER DATA FORM
Private _ParentForm As Form
Public Property ParentForm() As Form
Get
Return _ParentForm
End Get
Set(ByVal value As Form)
_ParentForm = value
End Set
End Property
Then you call the customer data form as below
Dim frmNewForm as new frmCustomerData
frmNewForm.ParentForm = frmChild
frmNewForm.Show()
This allows you from the customer data form to alter the field values
on the child form
_ParentForm.TextBox1.Text = "Joe Bloggs"
Regards,
Tony
Kevin wrote:
>I've got an mdiParent form. I open an instance of a child form like
this:
Dim frmChild as New frmCustomers
frmChild.Show()
I've got a few of these open at a time. On each frmChild I open
another form that displays customer data. When I make changes and save
the customer data, I need the updated data to show on the correct
frmChild. How do I know which form opened the customer data form and
how would I reference it?