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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:40:34+00:00 2026-05-16T22:40:34+00:00

I need to Enable/Disable my SAVE button in real time based on data in

  • 0

I need to Enable/Disable my SAVE button in real time based on data in my fields.

Is the below an acceptable way on accomplishing this? It feels wrong but I don’t know how else I could accomplish this.

Each User Control(CRUD Form) has a BackgroundWorker and the following related methods;

  • StartBGWorker()
  • StopBGWorker()
  • RequiredFieldsValid()

There purpose is self-explanatory, I hope. The process goes in such a way that when a User clicks NEW or EDIT it places a call to StartBGWorker() which creates a new BackgroundWorker and calls RunDataASync() for it. The DoWork() method of the BGWorker looks like this:

    void bgWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)
    {
        ucNavDiagnosis.btnSave.Enabled = Convert.ToBoolean(e.UserState);
    }

    void bgWorker_DoWork(object sender, DoWorkEventArgs e)
    {            
        while (true)
        {                
            bgWorker.ReportProgress(0, RequiredFieldsValid());
            System.Threading.Thread.Sleep(500);
        }
    }

private bool RequiredFieldsValid()
{
    // TODO: Add other required fields
    return (!memAllergies.Text.Equals(string.Empty));
}

This works but feels “bush-league.” Anyway, when the User clicks SAVE or CANCEL a call to StopBGWorker() is placed which Disposes the worker.

As a further disclaimer, this app does not currently use binding. It’s a long explanation but that’s that, as they say.

  • 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-16T22:40:35+00:00Added an answer on May 16, 2026 at 10:40 pm

    How about using the validating events to update the enabled status of your save button?!!

    protected virtual void MyTextBox_OnValidating(CancelEventArgs e)
    {
         this.SaveButton.Enabled = (Validate(MyTextBox));
    }
    

    As well, if you are doing validation, I highly recommend looking into MS enterprise library validation to handle informing the user of input errors. Also, check out this.

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

Sidebar

Related Questions

I need to enable/disable completely network interfaces from a script in Windows XP. I'm
I need to use one logical PGM based multicast address in application while enable
I need to enable the mcrypt functions on my website, except I'm on a
I need to programmatically enable READ COMMITTED SNAPSHOT in SQL Server. How can I
I need to write robust code in .NET to enable a windows service (server
Need a way to allow sorting except for last item with in a list.
I need to profile a server-client Java application (based on Jersey/REST FYI). I have
I need a JComponent thad enables editing xml documents so I can embed it
I need my application to behave differently depending on whether Vista UAC is enabled
Need a function that takes a character as a parameter and returns true if

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.