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

  • SEARCH
  • Home
  • 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 582067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:38:51+00:00 2026-05-13T14:38:51+00:00

I have two forms and I am trying to capture an event generated from

  • 0

I have two forms and I am trying to capture an event generated from frmEventGenerate.cs in frmEventReceive.cs.

In this example I can receive the event from frmEventGenerate.cs but not sure how I can catch this in frmEventReceive.cs? frmEventReceive.cs is my startup form which creates frmEventGenerate.cs.

Can someone point me in the right direction, I think I am being stupid!

Thank you

frmEventGenerate.cs:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Events
{
    public delegate void LinkToEventHandler();

    public partial class frmEventGenerate : Form
    {
        public static event LinkToEventHandler Evt;

        public frmEventGenerate()
        {
            InitializeComponent();
            Evt += new LinkToEventHandler(ReceiveEvent);
            SendEvent();
        }

        public static void SendEvent()
        {
            if (Evt != null)
            {
                Evt();
            }
        }

        public void ReceiveEvent()
        {
            System.Console.WriteLine("Received Event - This works ok");
        }
    }
}

frmEventReceive.cs:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Events
{
    public partial class frmEventReceive : Form
    {
        public frmEventReceive()
        {
            InitializeComponent();
            frmEventGenerate frmGen = new frmEventGenerate();
        }

        public void ReceiveEvent()
        {
            System.Console.WriteLine("I want to be able to receive the even here!");
        }

    }
}
  • 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. Editorial Team
    Editorial Team
    2026-05-13T14:38:51+00:00Added an answer on May 13, 2026 at 2:38 pm

    In your constructor, after instantiating frmEventGenerate:

    frmGen.Evt += ReceiveEvent;
    

    You don’t need new LinkEventHandler(...) any more – as of C# 2, there’s a method group conversion available which you can use to convert from a method group (the name of a method) to a delegate type.

    EDIT: I hadn’t seen that your event was static. That suggests you should actually use:

    frmEventGenerate.Evt += ReceiveEvent;
    

    … and you don’t need the frmGen variable at all.

    However, I would strongly discourage you from this – why do you want the event to be static in the first place? (I’d also urge you to name your types more sensibly – something like “EventGenerator” would be better here, for example. Ignoring the convention that type names should be in Pascal case leads to confusing code.)

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

Sidebar

Related Questions

I'm trying to get crawl to work on two separate farms I have but
I have two forms, form A and form B. These forms must differ in
I have two forms on a page (one is being grabbed by AJAX). I
I have two forms in my rails app. They both exist in separate tabs
I have two completely different forms in one template. How to process them in
I am using standard windows forms controls under C#. I have two controls which
I have two windows forms.Now I have to close first one and show the
I created a project with Django and am trying to write from forms to
This is tricky.. I have two sites. Site A and site B. On another
I have two different grid controls on the same form. They share the same

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.