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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:05:57+00:00 2026-05-26T16:05:57+00:00

I made a C# Windows Form. It uses a web method, and then I

  • 0

I made a C# Windows Form. It uses a web method, and then I want to write the webmethod results to a listbox. The web method runs in a loop until I push a stop button.

The issue I’m having is, I’m unable to click any of the controls on the form, and even moving around the form itself is impossible.

The function of adding the webmethods results to the list box are working though. But it’s pretty much useless since I can’t scroll down the list of added items.

I put a 1 second sleeper time between each web method call, but that’s not helping…

bool stop = false;
private void button1_Click(object sender, EventArgs e)
{
    stop = false;
    while (stop == false) { 
        GetTime(textBox1.Text);
        System.Threading.Thread.Sleep(1000);
    }
}

private void GetTime(string mid)
{
    string i;
    com.Service test = new com.Service();
    i = test.GetZonedDateTimeByMID(mid).ToString();
    lstLog.Items.Add(i);
}

private void btnStop_Click(object sender, EventArgs e)
{
    stop = true;
}
  • 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-26T16:05:57+00:00Added an answer on May 26, 2026 at 4:05 pm

    Calling the static method Thread.Sleep(X) will cause the current thread (in your case, your application’s UI thread) to sleep. So yes, that will make your application unresponsive. You need to do your work from a background worker thread, either by using a Task or calling ThreadPool.QueueUserWorkItem.

    However, be aware that you can’t update UI elements directly from any thread other than your application’s UI thread, you will need to call the control’s Invoke method.

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

Sidebar

Related Questions

Most precompiled Windows binaries are made with the MSYS+gcc toolchain. It uses MSVCRT runtime,
I made a .NET Windows form that allows users to view a particular document
I'm Using Process.Start from my website to open a windows form application I made
I made a windows form application which maps whole of spsite (given in text
I made a windows form with many dropdown list which are placed inside a
I have a visual c++ windows form application (empty) made on visual studio 2008
So i have created Windows Form Application and made a library added a reference
I have a Windows form user control that is made COM visible. Now I
I made a windows service. My code is similar to: onstart() { while(true) {
i made a windows service & add project installer.in which only contain this code.

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.