Passing dataset value to 2 forms

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

Hello,
Here is my scenario. I have a MDIForm, and 2 Child forms (ChildForm1 and
ChildForm2). The child forms can only be opened by their own toolbar icon on
the MDIForm. When I open ChildForm1, I have a datagrid that I may want to
search for a specific record from time to time. When I want to search for a
record, I click on the toolbar for ChildForm2 which basically gives me a
textbox for input. Once I click the OK button on ChildForm2, I want to close
that down, and move to the particular record in the grid that has that
information.
Now, my MDIForm is being referenced in the constructor of ChildForm2
already, but this is where I get confused. There are a lot of examples out
there for my problem, IF I had accessed ChildForm2 from ChildForm1. But
since I am opening ChildForm2 from the MDIForm, I don't know what to do.
What I want to do is run the search code directly from ChildForm2 after
the OK button on ChildForm2 has been clicked, and then close the form, and
move to that record on the grid in ChildForm1. So, I'm guessing what I need
to do is pass the dataset (or access it in any way) from ChildForm1 to
ChildForm2 so I can do the search, then move back to ChildForm1. Sorry about
any confusion, and thank you in advance.

Steve
 
Hi Steve,

Based on my understanding, you have MDIForm and two child forms.(CF1,CF2)
On MDIForm there is two buttons ,each button will open a child form.
1. Where and when you will instance the child form, i.e. when you will "New
the two child forms"
with the code similar with below.
Dim fc1 As New cf1
fc1.MdiParent = Me' Me here is the MDI form
Dim fc2 As New cf2
fc2.MdiParent = Me

2. If when you open the CF2, the CF1 has already been opened, since you
hold the reference to MDI form, then by using the MdiChildren property of
MDI form, you can also get a reference to the ChildForm2(CF2) from
ChildForm1(CF1).


Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top