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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:45:53+00:00 2026-05-27T10:45:53+00:00

I am trying to use asynchronous calls to save a database and I have

  • 0

I am trying to use asynchronous calls to save a database and I have realised my understanding of how things work may be incorrect. I have done a number of google searches but it hasn’t helped to reduce my confusion

What I have is similar to the following:

private delegate bool MyDelegate();

private void ExportButton_Click(object sender, EventArgs e)
{
    // Disable button
    exportButton.Enabled = false;

    MyDelegate deleg = ExportDatabase;

    // Begin the export
    deleg.BeginInvoke(ExportDatabaseCallback, null);
}

public bool ExportDatabase()
{
    // Do Stuff
    return true;
}

private void ExportDatabaseCallback(IAsyncResult ar)
{
    // Enable button
    Invoke((MethodInvoker)delegate { exportButton.Enabled = true; });

    MessageBox.Show("Exporting Database complete");
}

Now, looking at other pages seems to indicate in my BeginInvoke I should do this as: deleg.BeginInvoke(new AsyncCallback(ExportDatabaseCallback), null); but what I have works, so am I doing something wrong here?

the other thing is that I believe in my callback I am supposed to call EndInvoke() as other stackoverflow questions state it is not optional. But then in other places it seems it is? But most comments I can find are from 2009 and I don’t know if things have changed since then. Is this the only way to get the bool from the ExportDatabase?

  • 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-27T10:45:54+00:00Added an answer on May 27, 2026 at 10:45 am
     new AsyncCallback(ExportDatabaseCallback)
    

    is just the old, longer way to create a delegate. Your code does exactly the same.

    And EndInvoke() is sometimes optional but you don’t want to know when and when not. Just call it, and you’re always right.

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

Sidebar

Related Questions

I am trying to use the .NET Reactive Framework to simplify some asynchronous calls
I'm trying to understand when I should use asynchronous web calls back to the
I am trying to use Ajax asynchronous call backs with grails. In my gsp
I am trying to use Reactive Extensions to write code to handle an asynchronous
We are trying to produce a library component which will perform asynchronous calls. For
I have been trying to use a .gif file from my resources, but I
I am trying to use RPC calls for fetching data from the Server-->DB and
I'm trying to do an asynchronous request with ASIHTTPRequest, but have some problem getting
I'm trying to use Method.Invoke to call a windows form dialog, have a user
I was trying use a set of filter functions to run the appropriate routine,

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.