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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:22:19+00:00 2026-05-13T19:22:19+00:00

just a quick question. First of all, let me verify that I have the

  • 0

just a quick question. First of all, let me verify that I have the correct meaning of a function pointer. In the case of C#, a function pointer is basically just an event function am i right?

second, consider the following snippet:

public FormAnimator(Form form) 
{ 
    this.m_Form = form;       
    this.m_Form.Load += new EventHandler(m_Form_Load);
    this.m_Form.VisibleChanged += new EventHandler(m_Form_VisibleChanged);
    this.m_Form.Closing += new CancelEventHandler(m_Form_Closing);  
}

where m_Form is a private variable of type

   //The form to be animated. 
    private Form m_Form;  

Heres how the class is instantiated:

public partial class toastform : Form
{   
    public toastform(skImage ic) : this() {

        //Attach this form to the Formanimator. 
        //The FormAnimator now has a reference to this toastform.
        //When the load() of this form is invoked, the Form animator intercepts it and displays the form.
        this.m_Animator = new FormAnimator(this, FormAnimator.AnimationMethod.Slide, FormAnimator.AnimationDirection.Up, 400);

        }

so when i create a new toastform (with the something = new toastform();) and call the Show() the show method SHOULD be the one from the form animator. Now, when the toastform closes, how do I make sure the FormAnimator object is also destoryed.. if someone can please explain the full story of what is happening, i’d appreciate that. what i mean is that .. do the toastform class, and the formanimator class both point to the same object, is my lingo right when i say form animator “intercepts” the taostform’s events and so on..

thanks

tldr: I just need to know if I need to manually remove handlers for the events in Formanimator class.

  • 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-13T19:22:19+00:00Added an answer on May 13, 2026 at 7:22 pm

    In your Dispose function, you should detach your function references.

    protected override Dispose(bool disposing)
    {
        ....
    
         this.m_Form.Load -= new EventHandler(m_Form_Load);
         this.m_Form.VisibleChanged -= new EventHandler(m_Form_VisibleChanged);
         this.m_Form.Closing -= new CancelEventHandler(m_Form_Closing);  
    }
    

    Or, you can use Weak References.

    Here is a very, very good article on weak references:

    http://diditwith.net/PermaLink,guid,aacdb8ae-7baa-4423-a953-c18c1c7940ab.aspx

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

Sidebar

Related Questions

Quick question. I have been Googling this all morning, but it's either not there,
quick question. In my user database I have 5 separate tables all containing different
I thought the C/C++ vs C#/Java performance question was well trodden, meaning that I'd
I have a quick question with some jQuery where I'm running into a problem.
Just a really quick question here. I'm using virtual functions to read in from
Just a quick question regarding re-useable code. Ive lately been trying to modularise my
First of all I DO realize that there are many similar questions like this
Just a quick question about my Domain Layer/ Domain Service... Should I allow this
Before I go messing my database up, I have a quick question: What is
I have a quick jQuery question (well I'm hoping it's quick anyway!) I've been

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.