Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Updating text in a form while other tasks are happening

Updating text in a form while other tasks are happening

Scheduled Pinned Locked Moved C#
databasebeta-testingcode-review
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    quilkin
    wrote on last edited by
    #1

    When my app starts up it needs to spend a few seconds getting data from a database, and structuring tables etc. The user needs to know something is going on while this happens so I made a simple form that gives some feedback e.g."xxx is now loading". Trouble is, the app is so busy loading the data that it never gets the chance to write the text in the form. The title is there, but little else (until the data has finished loading, when the form is not required any more anyway!) - just empty 'holes' which let the underlying screen show through. There must be a simple solution to this but it eludes me.

    L 1 Reply Last reply
    0
    • Q quilkin

      When my app starts up it needs to spend a few seconds getting data from a database, and structuring tables etc. The user needs to know something is going on while this happens so I made a simple form that gives some feedback e.g."xxx is now loading". Trouble is, the app is so busy loading the data that it never gets the chance to write the text in the form. The title is there, but little else (until the data has finished loading, when the form is not required any more anyway!) - just empty 'holes' which let the underlying screen show through. There must be a simple solution to this but it eludes me.

      L Offline
      L Offline
      LongRange Shooter
      wrote on last edited by
      #2

      What is required here is to have the main form perform the tasks while another form on another thread is processing the display. While it sounds complex, we have an article here[^] that will implement everything for you. I like this screen because of the predictive nature of the status bar. The only item I don't like is that it shows no progress the first time it is run unless you prepopulate the registry. If you'd prefer other approaches, do a search from the home page for articles on Splash Screen.

      Q 1 Reply Last reply
      0
      • L LongRange Shooter

        What is required here is to have the main form perform the tasks while another form on another thread is processing the display. While it sounds complex, we have an article here[^] that will implement everything for you. I like this screen because of the predictive nature of the status bar. The only item I don't like is that it shows no progress the first time it is run unless you prepopulate the registry. If you'd prefer other approaches, do a search from the home page for articles on Splash Screen.

        Q Offline
        Q Offline
        quilkin
        wrote on last edited by
        #3

        Thanks 'Condor', this is a bit top-heavy in terms of code size (compared with what I was expecting!) but I have to admit the result is very nice. I'll use it.

        L 1 Reply Last reply
        0
        • Q quilkin

          Thanks 'Condor', this is a bit top-heavy in terms of code size (compared with what I was expecting!) but I have to admit the result is very nice. I'll use it.

          L Offline
          L Offline
          LongRange Shooter
          wrote on last edited by
          #4

          You're welcome. :-D ______________________________ The Tao gave birth to machine language. Machine language gave birth to the assembler. The assembler gave birth to ten thousand languages. Each language has its purpose, however humble. Each language expresses the Yin and Yang of software. Each language has its place within the Tao. Beauty exists because we give a name to C#. Bad exists because we give a name to COBOL.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups