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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:02:04+00:00 2026-05-30T20:02:04+00:00

I am developing a solution in VS2010 which involves 2 projects. The first project

  • 0

I am developing a solution in VS2010 which involves 2 projects. The first project is a normal windows form application with a button which increments an integer variable whenever it is pressed. The other project is a simple web service which returns the value of the variable. I have set the counter as both public and static as follows:

public static int count = 0;

private void AddCountButton_Click(object sender, EventArgs e)
{
    count++;
}

public static int GetCount()
{
    return count;
}

The other project has this method:

[WebMethod]
public int GetCount()
{
    return MyApplication.Form1.GetCount();
}

However, when the above method is called it always returns 0. I was hoping that someone would shed some light on the subject. Thankyou, and have a good day.

  • 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-30T20:02:05+00:00Added an answer on May 30, 2026 at 8:02 pm

    Your two projects are running as two different processes. One as a windows form, and the other as a web process. The count defined within your MyApplication.Form1 is not shared between these two processes.

    @John, thank you

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

Sidebar

Related Questions

I'm developing WinForms application using VS2010. I have about 15 projects in the solution.
I'm developing Asp.MVc 2 application. In solution i've about 10 projects and i have
I have a solution in VS2010 with 3 projects: WCFServiceLib - a project created
While uninstalling a VS2010 setup project I'm developing which installs a service, I am
I'm developing a solution which uses an ActiveX control (a commercial one which we
I'm developing a custom SharePoint solution which consist of a feature and a timer
In the web-application I'm developing I currently use a naive solution when connecting to
After developing a WPF application without Source Control, I decided to add the solution
I'm developing what is essentially a specialized firewall application. The solution needs to be
I have a web application project being developed in VS2010 targetting Framework 4.0. I

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.