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. Close MessageBox automaticly

Close MessageBox automaticly

Scheduled Pinned Locked Moved C#
helpquestion
10 Posts 5 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.
  • P Offline
    P Offline
    pcaeiro
    wrote on last edited by
    #1

    Hello, Is it possible to close a messageBox automaticly after few seconds? Any one can help me? :doh: Thanks PC

    J C M 3 Replies Last reply
    0
    • P pcaeiro

      Hello, Is it possible to close a messageBox automaticly after few seconds? Any one can help me? :doh: Thanks PC

      J Offline
      J Offline
      Jordanwb
      wrote on last edited by
      #2

      You could but it would involve making your own class to use as a messagebox because the MessageBox class is static so you can inherit it and when you show it the code stops till you click OK. Feel free to prove me wrong anyone.

      1 Reply Last reply
      0
      • P pcaeiro

        Hello, Is it possible to close a messageBox automaticly after few seconds? Any one can help me? :doh: Thanks PC

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        Your best bet is just to write your own messagebox that does this.

        Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

        P 1 Reply Last reply
        0
        • C Christian Graus

          Your best bet is just to write your own messagebox that does this.

          Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

          P Offline
          P Offline
          pcaeiro
          wrote on last edited by
          #4

          Let me try to explain the my problem with my bad english... I have an aplication that runs a process in background and i was forced to stop the execution of the aplication until this process is complete, but this process could long for large seconds. So i must have a way to warn the user to wait, i thougt in a messageBox , and i do it, but than this messageBox stays until the user clicks ok, not until the end of the process. I have tried with a form but it does not work to well. The form stays full of holes (the places where it should load the labels). Could you sugest me other solution or a way to solve the problem with the form? thanks for your help. :confused: PC

          J P 2 Replies Last reply
          0
          • P pcaeiro

            Let me try to explain the my problem with my bad english... I have an aplication that runs a process in background and i was forced to stop the execution of the aplication until this process is complete, but this process could long for large seconds. So i must have a way to warn the user to wait, i thougt in a messageBox , and i do it, but than this messageBox stays until the user clicks ok, not until the end of the process. I have tried with a form but it does not work to well. The form stays full of holes (the places where it should load the labels). Could you sugest me other solution or a way to solve the problem with the form? thanks for your help. :confused: PC

            J Offline
            J Offline
            Jordanwb
            wrote on last edited by
            #5

            So you're using two seperate threads. Using the other thread (not the background one) create a timer that will tick after say a minute. When it ticks check to see if the background thread is still running. If it's still running show the messagebox. Even when the box is open the other thread will still run.

            P 1 Reply Last reply
            0
            • P pcaeiro

              Let me try to explain the my problem with my bad english... I have an aplication that runs a process in background and i was forced to stop the execution of the aplication until this process is complete, but this process could long for large seconds. So i must have a way to warn the user to wait, i thougt in a messageBox , and i do it, but than this messageBox stays until the user clicks ok, not until the end of the process. I have tried with a form but it does not work to well. The form stays full of holes (the places where it should load the labels). Could you sugest me other solution or a way to solve the problem with the form? thanks for your help. :confused: PC

              P Offline
              P Offline
              PIEBALDconsult
              wrote on last edited by
              #6

              May I humbly suggest my http://www.codeproject.com/KB/cs/PIEBALDProgressDialog.aspx[^]

              P 1 Reply Last reply
              0
              • J Jordanwb

                So you're using two seperate threads. Using the other thread (not the background one) create a timer that will tick after say a minute. When it ticks check to see if the background thread is still running. If it's still running show the messagebox. Even when the box is open the other thread will still run.

                P Offline
                P Offline
                pcaeiro
                wrote on last edited by
                #7

                Yes, you are rigth i'm following your advice, but it still not perfect because if the thread that runs in background ends, and the user dont press OK before, i will have the messageBox in the screen but the program its already in another fase (since its a caind of Wizard). But i think i must live with that because i don“t find a better answer. Perhaps i should follow your 1st advice and built my one class for the messageBox. Thanks for the help :) PC

                1 Reply Last reply
                0
                • P PIEBALDconsult

                  May I humbly suggest my http://www.codeproject.com/KB/cs/PIEBALDProgressDialog.aspx[^]

                  P Offline
                  P Offline
                  pcaeiro
                  wrote on last edited by
                  #8

                  thanks for the tip, that code seems very helpfull and its a better solution that the messageBox. Many thanks PC

                  1 Reply Last reply
                  0
                  • P pcaeiro

                    Hello, Is it possible to close a messageBox automaticly after few seconds? Any one can help me? :doh: Thanks PC

                    M Offline
                    M Offline
                    MNFlyer
                    wrote on last edited by
                    #9

                    One way is to create your own form with an OnTimer event. The form can be just a label that you assign text to prior to showing it. Then the OnTimer event can call this.close();

                    P 1 Reply Last reply
                    0
                    • M MNFlyer

                      One way is to create your own form with an OnTimer event. The form can be just a label that you assign text to prior to showing it. Then the OnTimer event can call this.close();

                      P Offline
                      P Offline
                      pcaeiro
                      wrote on last edited by
                      #10

                      I have already solved that problem, just like you sugest... Thank you :-D PC

                      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