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. Freeze user access

Freeze user access

Scheduled Pinned Locked Moved C#
question
6 Posts 3 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.
  • G Offline
    G Offline
    Glen Harvy 0
    wrote on last edited by
    #1

    Hi, I have a form that does a lot of processing, some using background threads. What I want to do is "disable" any user actions until the processing is finished BUT still have the prgressbar continue if the user does try to click on the form somewhere. I have tried the lock method but this freezes the progressbar if a user clicks somewhere. I've also tried disabling the main form but that doesn't disable individual controls on that form, especially tab pages. I don't want to completly rewrite my program using all background threads. How can I disable any user interaction? TIA for any suggestions.

    Glen Harvy

    G 1 Reply Last reply
    0
    • G Glen Harvy 0

      Hi, I have a form that does a lot of processing, some using background threads. What I want to do is "disable" any user actions until the processing is finished BUT still have the prgressbar continue if the user does try to click on the form somewhere. I have tried the lock method but this freezes the progressbar if a user clicks somewhere. I've also tried disabling the main form but that doesn't disable individual controls on that form, especially tab pages. I don't want to completly rewrite my program using all background threads. How can I disable any user interaction? TIA for any suggestions.

      Glen Harvy

      G Offline
      G Offline
      Giorgi Dalakishvili
      wrote on last edited by
      #2

      this.UseWaitCursor=true; can help you

      #region signature my articles #endregion

      G 1 Reply Last reply
      0
      • G Giorgi Dalakishvili

        this.UseWaitCursor=true; can help you

        #region signature my articles #endregion

        G Offline
        G Offline
        Glen Harvy 0
        wrote on last edited by
        #3

        Unfortuately that doesn't stop the user from clicking on a control on the form causing the status bar to freeze.

        Glen Harvy

        L 1 Reply Last reply
        0
        • G Glen Harvy 0

          Unfortuately that doesn't stop the user from clicking on a control on the form causing the status bar to freeze.

          Glen Harvy

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          The normal way to solve this would be to open a modal dialog that holds the progress bar and a Cancel Button. :)

          Luc Pattyn [Forum Guidelines] [My Articles]


          this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


          G 1 Reply Last reply
          0
          • L Luc Pattyn

            The normal way to solve this would be to open a modal dialog that holds the progress bar and a Cancel Button. :)

            Luc Pattyn [Forum Guidelines] [My Articles]


            this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


            G Offline
            G Offline
            Glen Harvy 0
            wrote on last edited by
            #5

            When opening the modal dialog how do I allow the mainForm to continue processing? I have always thought that the normal way of doing it was to create a backgroundworker, have it do the processing and update a progress bar on the main form.

            Glen Harvy

            L 1 Reply Last reply
            0
            • G Glen Harvy 0

              When opening the modal dialog how do I allow the mainForm to continue processing? I have always thought that the normal way of doing it was to create a backgroundworker, have it do the processing and update a progress bar on the main form.

              Glen Harvy

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #6

              Hi Glen, Disabling a form can be handled in several ways: you can disable all the Controls (not recommended), hide the form, or make sure it can't get focus (that is exactly what you get with a modal dialog). There are many ways to get the work done; using a Thread, a ThreadPool thread, or a BackgroundWorker are amongst them. And that is independent of your form situation; the thread or whatever simply runs in the background; it gets organized by either the form or the modal dialog, your choice. Hope this helps.

              Luc Pattyn [Forum Guidelines] [My Articles]


              this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


              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