Link to home
Start Free TrialLog in
Avatar of Ilianam
Ilianam

asked on

MDI FOrms

I have a menu, which is the parent, and two forms (search, details) which are mdichildren
In search I have a datagrid that displays the results of the search, when you click in any row, it opens details.
In details, I can add, delete, update...But I want to be able to refresh the grid from detail
Any idea?
Avatar of wguerram
wguerram

You detail from use the same dataset as your search result form?
Avatar of Ilianam

ASKER

no
How are you actually populating you grid in search results?
Avatar of Ilianam

ASKER

It's binded to a dataset. Then I keep the contact_id in a public variable and in my detail I execute an sp which has contact_id as a parameter....Then I populate the fields
One way would be to make changes to the dataset of your search form from detail form.

But you would have to make double changes.

the other one would be to fill you Dataset throug the DataAdapter, again after you make changes in your detail form.
You could use events to let the search form know the details have changed. Define an event in your details form:

    Public Event DetailsModified(ByVal sender As Object, ByVal ContactID As Integer)

Then, wire the event when you create the details form:

    Dim frm As New DetailsForm()
    AddHandler frm.DetailsModified, AddressOf MyDetailsHandler


Finally, you raise the event when the user adds, deletes, or updates:

    RaiseEvent DatailsModified(this, m_intContactID)

As a side note, I would create a constructor in your details form to accept the contact_id rather than storing it in a global variable. With your current setup, you can only have one detail form open at a time without introducing logic errors.
ASKER CERTIFIED SOLUTION
Avatar of wguerram
wguerram

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial