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 7808423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:07:53+00:00 2026-06-02T03:07:53+00:00

I have a static event in a DLL that I use frequently – Toolkit.Dialogs.ExitConfirm

  • 0

I have a static event in a DLL that I use frequently – Toolkit.Dialogs.ExitConfirm

The only way I can use this event is by modifying the line that adds the event in form.Designer.cs. Example:

this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);

becomes

this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(Toolkit.Dialogs.ExitConfirm);

If I try to add it via the Properties->Events page, it gives me this error: ‘Toolkit.Dialogs.ExitConfirm’ is not a valid identifier.

Is there a way to allow Form Designer to reference events from other classes/namespaces?

Edit: some people work better with visual cues, so here’s some images to define the issue: https://i.stack.imgur.com/3fsRd.jpg

The first image shows how I have to make it work in Visual Studio – an event that calls an event.

The second image shows what I’m actually trying to do.

The third image is the error that occurs when I key in the method name by hand.

  • 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-06-02T03:07:54+00:00Added an answer on June 2, 2026 at 3:07 am

    The WinForms designer isn’t designed to do that. I’m a little surprised it doesn’t lose your event the next time you make a change in the designer.

    A few ideas on other ways you could make this work:

    • You could make a Form class that hooks the event for you, and descend all your other forms from that base class. Then you’d get the behavior everywhere.
    • You could make a utility method that hooks the event for you, and call it from each form’s constructor.
    • You could make an extension method that hooks the event and then shows the form, and call your extension method everywhere you show your forms (instead of calling Show).

    The base class is probably the simplest solution, as long as you aren’t already using form inheritance for some other purpose.

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

Sidebar

Related Questions

I have a static method that returns a String, but in the event that
I have a 32-bit app that makes use of Java Accessibility (WindowsAccessBridge-32.dll, via the
I have a class essentially: public class WindowEvent extends Event { public static const
I have declared a static string drivePath in Gloabal.asax.cs. In Onstart event of webrole
Suppose I have static ip in a subnet that has DHCP server. If i
Why can we have static final members but cant have static method in an
I intended to create a class which only have static members and static functions.
I have a .NET Compact Framework app that can runs on three windows machines
I've got this code: [DllImport(user32.dll)] static extern void mouse_event(uint dwFlags, uint dx, uint dy,
Pretty new to threading and I have this QList that the threads share between

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.