Passing Forms to other forms

Posted on 2007-08-08
Last Modified: 2013-11-05
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
Question by:rocky050371
    LVL 96

    Expert Comment

    by:Bob Learned
    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.

    LVL 8

    Expert Comment

    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

    Author Comment

    Can you create an interface which has public properties?
    LVL 96

    Accepted Solution

    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


    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    Join & Write a Comment

    In my previous article ( we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now