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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:16:18+00:00 2026-06-17T17:16:18+00:00

I am trying something quite basic. I have 3 labels on my windows form,

  • 0

I am trying something quite basic.

I have 3 labels on my windows form, which I would like to populate from 3 separate queries from the database, but also to show the user that something is happening, I would like to show each label as the data is available from the respective query.

To do this, I can use:

Form.ActiveForm.Refresh();

However, if the user clicks on any other window on their desktop, that command fails, with the “object not set” error.

Is there any way that I can refresh the labels on the Form, even if the form window is not the active window?

// Breach within next hour
DataTable tbBreach = (get info from database)
tbBreach.DefaultView.Sort = "Assignee ASC";
dgBreach.DataSource = tbBreach;
lbBreach2.Text = tbBreach.Rows.Count.ToString();
Form.ActiveForm.Refresh();  //Would like to update this form field now, and show it on the form

// Breach within next 24 hour
DataTable tbBreach24 = (get info from database)
tbBreach24.DefaultView.Sort = "Assignee ASC";
dgBreach24.DataSource = tbBreach24;
lbBreach24.Text = tbBreach24.Rows.Count.ToString();
Form.ActiveForm.Refresh();

Thank you,

Mark

  • 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-06-17T17:16:18+00:00Added an answer on June 17, 2026 at 5:16 pm

    The labels will be refreshed automatically at the end of the elaboration.

    You probably want to force the refresh to update labels in the middle of the elaboration and you can do that simply using this.Refresh() since I suspect the method is located inside the form class.

    However, when you have a long elaboration and you need to keep the UI updated and reactive (i.e. not frozen) the suggested approach is to avoid elaboration on the UI thread, but to delegate the work on another thread using a BackGroundWorker.

    Here’s a working example of BackGroundWorker usage.

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

Sidebar

Related Questions

I have quite a basic WPF form with a DockPanel, there's a Menu bar,
I'm trying to achieve something quite basic. I am using an openly available jQuery
I have a form that is loading quite an amount of data from SQL
This is probably something quite basic. I am trying to implement AdWhirl into my
I am trying to do something that's quite complex (for me anyway) and I've
I am trying to learn something about WPF and I am quite amazed by
I'm trying something like this, but this example does not work. jsObj = {};
I'm trying something like this: [ServiceContract ( CallbackContract = typeof (CallbackContract_1), CallbackContract = typeof
As the title goes I am trying something like $(ul li:nth-child(' + xx +
Hi I have an Issue when trying to run a widows batch script from

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.