Passing Forms to other forms

I have a grid which the user can search on, they search via a find form. When they enter it calls the search back in the grid form. If I pass the grid form to the find form y

ByVal owningForm As frmcontacts

then I can activate the methods of frmcontacts.


The problem is I have numerous grids, so I need to make sure the find form can handle all forms implementing processsearch
Who is Participating?
Bob LearnedConnect With a Mentor Commented:
You define the interface without any scope modifiers:

Public Interface ISearchForm
   Sub ProcessSearch
End Interface

Then, it is up to the implementing class to define the scope:

Public Class frmSearch
    Implements ISearchForm

   Public Sub ProcessSearch() Implements ISearchForm.ProcessSearch
   End Sub

End Class

Bob LearnedCommented:
You can have the form implement an interface, and then try to cast the form as that interface, and get at the ProcessSearch method from the interface.

instead of having a single find form why don't you created and instance of that form from the gird form.
when they hit your find button open it as a modal form  and then return to the same grid so everything is tied together.

good luck
rocky050371Author Commented:
Can you create an interface which has public properties?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.