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. Remove Confirm Dialog After Confirm?

Remove Confirm Dialog After Confirm?

Scheduled Pinned Locked Moved C#
questioncsharpxml
4 Posts 4 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.
  • J Offline
    J Offline
    j1e1g1
    wrote on last edited by
    #1

    First of all, I'm using the .NET COMPACT Framework. I have a message box, with yes and no buttons. When a user clicks yes, a large amount of logic is executed (databases are queried, xml is parsed, docs are printed, etc). All of this logic takes about 10 seconds to complete, but the confirmation dialog just hangs there with the yes button depressed until a "success" message box is displayed. My boss doesn't like the way this looks, because the program appears to be "frozen". I would like to have the confirmation box disappear after the user presses yes - is this only possible if i bring up something else (i.e. a progress bar)? Also, is it possible to have a progress bar in a messagebox? Here is the code I'm using for the confirmation box:

    if(MessageBox.Show("Backflush Pallet "+pallet+"?","Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
    {
    ...execute tons of logic...
    }

    Thanks, j1e1g1

    T R M 3 Replies Last reply
    0
    • J j1e1g1

      First of all, I'm using the .NET COMPACT Framework. I have a message box, with yes and no buttons. When a user clicks yes, a large amount of logic is executed (databases are queried, xml is parsed, docs are printed, etc). All of this logic takes about 10 seconds to complete, but the confirmation dialog just hangs there with the yes button depressed until a "success" message box is displayed. My boss doesn't like the way this looks, because the program appears to be "frozen". I would like to have the confirmation box disappear after the user presses yes - is this only possible if i bring up something else (i.e. a progress bar)? Also, is it possible to have a progress bar in a messagebox? Here is the code I'm using for the confirmation box:

      if(MessageBox.Show("Backflush Pallet "+pallet+"?","Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
      {
      ...execute tons of logic...
      }

      Thanks, j1e1g1

      T Offline
      T Offline
      Tom Larsen
      wrote on last edited by
      #2

      Hmm...this is slightly tricky since that dialog isn't controled by you and therefore can't do self contained logic on how to appear/disappear. I'm not familiar with how the Compact Framework behaves but it might be solved if you let the message pump work. What might be going on is that the message "close dialog" is in the message queue but isn't being done because of the "execute tons of logic" bit. I'm not sure how long of a fishing excirse you want to go on but one thing you can try is putting the "execute tons of logic" in another thread and let the message pump work in the primary UI thread. I'm not sure if this will work because as I said I am not sure how the Compact Framework behaves with threaded behavior let alone how the UI functions in subtle behaviors like this.

      1 Reply Last reply
      0
      • J j1e1g1

        First of all, I'm using the .NET COMPACT Framework. I have a message box, with yes and no buttons. When a user clicks yes, a large amount of logic is executed (databases are queried, xml is parsed, docs are printed, etc). All of this logic takes about 10 seconds to complete, but the confirmation dialog just hangs there with the yes button depressed until a "success" message box is displayed. My boss doesn't like the way this looks, because the program appears to be "frozen". I would like to have the confirmation box disappear after the user presses yes - is this only possible if i bring up something else (i.e. a progress bar)? Also, is it possible to have a progress bar in a messagebox? Here is the code I'm using for the confirmation box:

        if(MessageBox.Show("Backflush Pallet "+pallet+"?","Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
        {
        ...execute tons of logic...
        }

        Thanks, j1e1g1

        R Offline
        R Offline
        Roman Rodov
        wrote on last edited by
        #3

        Wack in a call do Application.DoEvents() just before the "tons of logic" and the message box will disappear.

        1 Reply Last reply
        0
        • J j1e1g1

          First of all, I'm using the .NET COMPACT Framework. I have a message box, with yes and no buttons. When a user clicks yes, a large amount of logic is executed (databases are queried, xml is parsed, docs are printed, etc). All of this logic takes about 10 seconds to complete, but the confirmation dialog just hangs there with the yes button depressed until a "success" message box is displayed. My boss doesn't like the way this looks, because the program appears to be "frozen". I would like to have the confirmation box disappear after the user presses yes - is this only possible if i bring up something else (i.e. a progress bar)? Also, is it possible to have a progress bar in a messagebox? Here is the code I'm using for the confirmation box:

          if(MessageBox.Show("Backflush Pallet "+pallet+"?","Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
          {
          ...execute tons of logic...
          }

          Thanks, j1e1g1

          M Offline
          M Offline
          MilesAhead
          wrote on last edited by
          #4

          The simplest method would be to break the MessageBox.Show call out of the if block. DialogResult dr; dr = MessageBox.Show(yadda, yadda) if(dr == whatever) { .. do tons of whatever stuff }

          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