Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 139043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:21:52+00:00 2026-05-11T07:21:52+00:00

My scenario: Windows Forms Application with a base master (mdi) form. An Interface that

  • 0

My scenario:

Windows Forms Application with a base master (mdi) form.

An Interface that has an event:

Public Interface IDoSomething  Event AddFilter() 

Modal popup window implements the interface and decalres event:

Public Class frmPopup Implements IDoSomething  Public Event AddFilter() Implements IDoSomething.AddFilter 

Popup also contains code to fire the event:

RaiseEvent AddFilter() 

Base master form contains code that discovers and launches popup forms that implement a specified interface.

A form in the application launches the popup (that implements the interface) and handle any events that it fires. So I have the following code in the form:

Public Class frmMyForm  Public WithEvents m_Popup As IDoSomething  Public Sub m_Popup_AddFilter() Handles m_Popup.AddFilter      MsgBox('I'm in')  End Sub 

The code is all working, up until the stage where the event is fired. The popup loads without any issues but when the event fires it seems to drop off the face of the earth and is not being picked up by the main form – frmMyForm. I suspect it may have something to do with the way the popup form is being launched from the base master form via the discovery of the interface.

ADDITIONAL CODE – to expand on ‘Base master form contains code that discovers and launches popup forms that implement a specified interface’:

The idea of the popup forms that are being used is to return a business object to the form that opened it using events. The popup form Interface (IDoSomething) inherits another interface – IBusinessObjectSelector which specifies that the form will return a business object.

So the function in the base master form is:

Public Function GetBusinessObjectUsingPopup(Of O, F As IBusinessObjectSelector)                (ByRef dicPropertyValues As Dictionary(Of String, Object),                  Optional ByVal titleText As String = '')                  As O Implements IBaseMasterForm.GetBusinessObjectUsingPopup  Dim objBusinessObjectSelector As IBusinessObjectSelector = GetPopup(Of F)(False)            objBusinessObjectSelector.InitialiseForm()      ' Activate and show the dialog     If objBusinessObjectSelector.ShowPopup() <> Windows.Forms.DialogResult.OK Then         ' The user cancelled the load, so just exit         Return Nothing     End If      GetBusinessObjectUsingPopup = CType(objBusinessObjectSelector.SelectedBusinessObject, O)  End Function 

And Popup Code:

Public Function GetPopup(Of F As IBasePopupChildForm)             (Optional ByVal initialisePopupPriorToReturn As Boolean = True) As F               Implements IBaseMasterForm.GetPopup      Dim lstIBasePopupChildForm As List(Of F) = GetInterfaces(Of F)()             lstIBasePopupChildForm(0).MyIBaseMasterForm = Me     If initialisePopupPriorToReturn Then         lstIBasePopupChildForm(0).InitialiseForm()     End If     Return lstIBasePopupChildForm(0) End Function 

Note – GetInterfaces(Of F)() simply scans the assembly and returns a list of forms that implement the required interface. Some validation has been chopped out that returns messages if multiple forms that implement the interface are found.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T07:21:53+00:00Added an answer on May 11, 2026 at 7:21 am

    The critical part is initializing m_Popup correctly. You haven’t said anything about that. Some sample code:

    Form2:

    Public Class Form2     Implements IDoSomething     Public Event AddFilter() Implements IDoSomething.AddFilter      Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click         RaiseEvent AddFilter()     End Sub End Class  Public Interface IDoSomething     Event AddFilter() End Interface 

    Form1:

    Public Class Form1     Private WithEvents mPopup As IDoSomething      Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load         Dim f2 As New Form2         f2.Show(Me)         mPopup = f2     End Sub      Private Sub mPopup_AddFilter() Handles mPopup.AddFilter         MsgBox('yada')     End Sub End Class 

    The mPopup = f2 statement in this code is key.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 108k
  • Answers 108k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer A ManyToOne field, as you've guessed, is called ForeignKey in… May 11, 2026 at 9:12 pm
  • Editorial Team
    Editorial Team added an answer a rake file is a collection of tasks, when you… May 11, 2026 at 9:12 pm
  • Editorial Team
    Editorial Team added an answer I frequently use the rel (and rev) attributes with a… May 11, 2026 at 9:12 pm

Related Questions

I'm using the Yahoo Uploader, part of the Yahoo UI Library, on my ASP.Net
I have an application that is using Windows Authentication and a SqlRoleProvider for user
I have a file upload function in my asp.net mvc application that allows users
I have a web application (Java, Websphere, JSP) which allows co-workers to register visitors

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.