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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:40:06+00:00 2026-05-24T08:40:06+00:00

I am using C# to create a Silverlight 4 application. I am trying to

  • 0

I am using C# to create a Silverlight 4 application.

I am trying to do the following:

        MapNode endNode = null;

        if (keyword != null && keyword != "")
        {
            EntityQuery<NodeIDProj> res = CampusQueries.getNodeIDByNameQuery(keyword);

            var queryres = CampusQueries.Load<NodeIDProj>(res, (items) =>
            {
                foreach (var item in items.Entities)
                {
                    MapNode n = mapHelp.getNodeByID(item.NodeID);

                    if (n != null)
                    {
                        endNode = n;
                        TrackAnimation();

                    }
                }

            }, true);
         }

However, after this point, my variable endNode is still null. TrackAnimation() works as though endNode has a valid value, but outside of the Load statement, endNode is back to null.

I know that I am lacking in understanding of how this works, and I would really appreciate an help given.

What I am trying to do, is query my database and I want to use those results in other methods rather than displaying them in a datagrid.

I want endNode to have value which I can use in other methods.

Please help me to figure out a way to do this, thank you!

EDIT:

Thank you, SLaks

Can I do something like:

MapNode endNode = null;

    if (keyword != null && keyword != "")
    {
        EntityQuery<NodeIDProj> res = CampusQueries.getNodeIDByNameQuery(keyword);

        var queryres = CampusQueries.Load<NodeIDProj>(res, (items) =>
        {
            foreach (var item in items.Entities)
            {
                MapNode n = mapHelp.getNodeByID(item.NodeID);

                if (n != null)
                {
                    endNode = n;
                    TrackAnimation();

                }
            }

        }, true);
     }
 queryres.Completed += new EventHandler(queryres_Completed);




void queryres_Completed(object sender, EventArgs e)
{
    //stuff
}

If so, how can I get access to the endNode variable, as it is declared within another method?

  • 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-24T08:40:07+00:00Added an answer on May 24, 2026 at 8:40 am

    Your Load method is probably asynchronous, meaning that the callback happens some time after the rest of your code runs.

    You can only use the result after you actually receive it.

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

Sidebar

Related Questions

I am getting the following message when trying to create a new Silverlight application
I'm trying to create an silverlight application using the MVVM design pattern. It's a
I’m trying to create a new project using the Silverlight 4 business application template
I'm trying to create a Windows Phone 7 application, using either Silverlight or XNA,
I'm using Wix to create an installer for a Silverlight application. When I install
Im trying to create a simple pan and zoom app using silverlight 4, but
I am using Visual Studio 2010 to create a Silverlight 4 application. I set
I am developing a sample using silverlight and prism. I am trying to create
Following a couple different tutorials, I've been trying to build a Silverlight Business Application
When you create a silverlight 4 business application, using VS2010, by default you will

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.