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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:34:38+00:00 2026-05-28T18:34:38+00:00

I have a vb.net based windows application, where when GO button is clicked a

  • 0

I have a vb.net based windows application, where when “GO” button is clicked a bunch of data is loaded into DB. So in my application as soon as “GO” button is clicked I want to just disable it and would like to enable it back when the uploading has completed.
Now in my specific method for btnGo_Click() I have:

btnGo.Enabled = False

as first line and

btnGo.Enabled = True

as last line in the same method.

But I fail to understand why the “GO” though appears as being disabled still allows click when processing is going on. Also if I remove the last line, it gets disabled permanently and doesn’t allow the click event.

Kindly suggest what am I doing wrong?

Edit (Dated: 25th Jan 2012): I made changes as suggested by our collegues, but I am facing a new issue here. I am facing an issue where the textbox gets updated but not always. I have updated my textbox in “_ProgressChanged” event of the background worker thread. In my case if there is 10 records uploaded. Then there are 10 lines of updates that are expected in the texbox. But only few lines are shown in the textbox. Is it the repaint issue again? Kindly suggest…Because all other things are done as per your suggestion

  • 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-28T18:34:38+00:00Added an answer on May 28, 2026 at 6:34 pm

    You’re not doing anything wrong. The problem is that the UI doesn’t get updated until the code inside of your event handler method finishes executing. Then, the button is disabled and immediately enabled in rapid sequence.

    That explains why if you forget to reenable the button control at the end of the event handler method, it is still disabled—because you told it to disable the button in the first line of the method.

    This is a classic case of why you should never perform long-running computational tasks inside of an event handler method, because it blocks the UI from being updated. The computation actually needs to happen on a separate thread. But don’t try to create the thread manually, and definitely don’t try to update your UI from a separate thread. Instead, use the BackgroundWorker component to handle all of this for you automatically. The linked MSDN documentation has a great sample on how to use it.

    Disable the button before starting the BackgroundWorker, and then re-enable it in its Completed event, signaling the completion of your database load.

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

Sidebar

Related Questions

I have a Windows.Forms based .NET desktop application that stores privileged information in a
I am developing a windows based application in .net. I have two forms. Form2
We are delveloping C# windows based application .net 4 environment.In My application, i want
I have a three-tier Windows-based web application bundled into 3 AMIs on Amazon EC2
I have a .NET Windows Mobile 5.0 application that is used for data collection.
Let me share the following scenario: I have a ASP.NET intranet Web-based application that
We have a .net based application hosted with SAP enterprise portal iframes. The domain
We have .NET WinForms based application and it is expected to work on at
We are running a .Net 1.1 based Windows Service ( not an ASP.Net application),
I have a client server based windows forms application that needs an administrator only

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.