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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:59:35+00:00 2026-05-15T13:59:35+00:00

I have numerous occurrences of the following in my code: this.webBrowserCtrl.DocumentCompleted -= new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.LoginScreenLoaded);

  • 0

I have numerous occurrences of the following in my code:

this.webBrowserCtrl.DocumentCompleted -= new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.LoginScreenLoaded);
this.webBrowserCtrl.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.AttemptLoginAnalysis);

I wish to remove this and use a simple method that takes 2 inputs – however I don’t know what the types would be.

    private void DefineNewDocumentCompletedHandler(TYPEA inputA, TYPEB inputB)
    {

        this.webBrowserCtrl.DocumentCompleted -= new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(inputA);
        this.webBrowserCtrl.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(inputB);

    }

Does anyone know what TYPEA and TYPEB should be? Or another way to accomplish my goal?

  • 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-15T13:59:36+00:00Added an answer on May 15, 2026 at 1:59 pm

    Use the delegate type on the input parameters, like this:

    private void DefineNewDocumentCompletedHandler(WebBrowserDocumentCompletedEventHandler inputA, WebBrowserDocumentCompletedEventHandler inputB)
    {
        this.webBrowserCtrl.DocumentCompleted -= inputA;
        this.webBrowserCtrl.DocumentCompleted += inputB;
    }
    

    Example of use:

    DefineNewDocumentCompletedHandler(this.LoginScreenLoaded, this.AttemptLoginAnalysis);
    

    The syntax new <delegate type>(<name of method>) is a C# 1.x construct that is now obsolete. From C# 2.0 onwards, you can just specify the name of the method without parentheses, and the compiler will automatically wrap it in a delegate instance for you.

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

Sidebar

Related Questions

We are starting to have numerous linq to sql queries in our code. We
What I am trying to achieve is the following: I want to have numerous
I'm trying to find a solution for the following issue: I have numerous programs
Here's my situation I have numerous SQL rows like the following. SET IDENTITY_INSERT blah
I have numerous projects that all contain the exact same boilerplate code inside of
I have numerous Web Services in my project that share types. For simplicity I
I have numerous functions (unknown at design time) that each take a specific number
I have numerous Corba servers and some other java apps (not web). I wish
i have strange problem doing reporting: i have numerous clients with different issued invoices.
We are using jQuery in our project. We have numerous custom javascript files in

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.