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. this.show() doesn't display controls.

this.show() doesn't display controls.

Scheduled Pinned Locked Moved C#
question
8 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.
  • T Offline
    T Offline
    tingu
    wrote on last edited by
    #1

    I need to display form for 5 seconds. I have following code, this.show(); int ret1 = 0; int ret2 = 0; ret1 = Configure1(); ret2 = CreateLogin(); System.Threading.Thread.Sleep(5000); this.Close(); The form displays but it doesn't display the label on the form. Is there any other way to achieve the same?

    G L L 3 Replies Last reply
    0
    • T tingu

      I need to display form for 5 seconds. I have following code, this.show(); int ret1 = 0; int ret2 = 0; ret1 = Configure1(); ret2 = CreateLogin(); System.Threading.Thread.Sleep(5000); this.Close(); The form displays but it doesn't display the label on the form. Is there any other way to achieve the same?

      G Offline
      G Offline
      Gareth H
      wrote on last edited by
      #2

      harsha1305, Label?, What label. In the code you pasted you display something - guessing a form - and then get to int's, tell the thread to sleep and close the form. If you create the label in either Configure1(); or CreateLogin(); then you need to paste that code. Regards, Gareth.

      T 1 Reply Last reply
      0
      • G Gareth H

        harsha1305, Label?, What label. In the code you pasted you display something - guessing a form - and then get to int's, tell the thread to sleep and close the form. If you create the label in either Configure1(); or CreateLogin(); then you need to paste that code. Regards, Gareth.

        T Offline
        T Offline
        tingu
        wrote on last edited by
        #3

        Label is the control on the form.

        B 1 Reply Last reply
        0
        • T tingu

          Label is the control on the form.

          B Offline
          B Offline
          buchstaben
          wrote on last edited by
          #4

          you havent shown any code initializing a label. maybe you just need to call InitializeComponents()?

          1 Reply Last reply
          0
          • T tingu

            I need to display form for 5 seconds. I have following code, this.show(); int ret1 = 0; int ret2 = 0; ret1 = Configure1(); ret2 = CreateLogin(); System.Threading.Thread.Sleep(5000); this.Close(); The form displays but it doesn't display the label on the form. Is there any other way to achieve the same?

            L Offline
            L Offline
            led mike
            wrote on last edited by
            #5

            Um you can't use Show,Sleep, and finally close in sequence and expect to get any UI behavior. Use a Timer rather than sleep and put the close in the timer event handler.

            led mike

            T 1 Reply Last reply
            0
            • T tingu

              I need to display form for 5 seconds. I have following code, this.show(); int ret1 = 0; int ret2 = 0; ret1 = Configure1(); ret2 = CreateLogin(); System.Threading.Thread.Sleep(5000); this.Close(); The form displays but it doesn't display the label on the form. Is there any other way to achieve the same?

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

              Hi, I strongly advise against it in general, but here is a good opportunity to use Application.DoEvents(); just in front of the Sleep. However it is always better to use threading, since your Sleep will put the GUI interaction out of service for 5 seconds no matter what. :)

              Luc Pattyn [Forum Guidelines] [My Articles]


              This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.


              1 Reply Last reply
              0
              • L led mike

                Um you can't use Show,Sleep, and finally close in sequence and expect to get any UI behavior. Use a Timer rather than sleep and put the close in the timer event handler.

                led mike

                T Offline
                T Offline
                tingu
                wrote on last edited by
                #7

                Can you send me sample code for timer for 5 seconds? I just want it to display the form for 5 seconds before closing.

                L 1 Reply Last reply
                0
                • T tingu

                  Can you send me sample code for timer for 5 seconds? I just want it to display the form for 5 seconds before closing.

                  L Offline
                  L Offline
                  led mike
                  wrote on last edited by
                  #8

                  I don't want to offend you but if you plan on being a capable software developer you need to learn to read documentation and how to find things like that for yourself. It is very likely that the documentation for the Timer class on MSDN has example code.

                  led mike

                  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