How can I make my VB .Net program sleep for 5 minutes?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Roger Solano

    How can I make my VB .Net program sleep for 5 minutes?

    How can I make my VB .net program sleep or pause for say 5 minutes?

    Any help would be much appreciated.

    Roger


  • Herfried K. Wagner [MVP]

    #2
    Re: How can I make my VB .Net program sleep for 5 minutes?

    * "Roger Solano" <rsolano@cobeca .com> scripsit:[color=blue]
    > How can I make my VB .net program sleep or pause for say 5 minutes?[/color]

    'System.Threadi ng.Thread.Sleep (5000)'.

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

    Comment

    • Ricky W. Hunt

      #3
      Re: How can I make my VB .Net program sleep for 5 minutes?

      "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
      news:%236hyiJ8j EHA.2908@tk2msf tngp13.phx.gbl. ..[color=blue]
      > * "Roger Solano" <rsolano@cobeca .com> scripsit:[color=green]
      > > How can I make my VB .net program sleep or pause for say 5 minutes?[/color]
      >
      > 'System.Threadi ng.Thread.Sleep (5000)'.[/color]

      I think it's in milliseconds so 5 minutes would be
      'System.Threadi ng.Thread.Sleep (300000)' 'three hundred thousand ms.


      Comment

      • Cor Ligthert

        #4
        Re: How can I make my VB .Net program sleep for 5 minutes?

        Ricky[color=blue]
        >
        > I think it's in milliseconds so 5 minutes would be
        > 'System.Threadi ng.Thread.Sleep (300000)' 'three hundred thousand ms.[/color]

        You know how fast Herfried is he post in a second what another does in a
        minute.

        :-)

        Cor


        Comment

        • Cor Ligthert

          #5
          Re: How can I make my VB .Net program sleep for 5 minutes?

          Roger,

          In additon to the others,

          When you do this than mostly is adviced to use a timer or to use a different
          thread. Because your program stops completly and your user cannot even
          cancel it in a normal way.

          An easy way to prevent that freezing is
          For i = 1 to 300
          threading.threa d.sleep(i * 1000)
          application.doe vents
          next
          [color=blue]
          > How can I make my VB .net program sleep or pause for say 5 minutes?
          >
          > Any help would be much appreciated.
          >
          > Roger
          >
          >[/color]


          Comment

          • Herfried K. Wagner [MVP]

            #6
            Re: How can I make my VB .Net program sleep for 5 minutes?

            * "Ricky W. Hunt" <rhunt22@hotmai l.com> scripsit:[color=blue][color=green][color=darkred]
            >>> How can I make my VB .net program sleep or pause for say 5 minutes?[/color]
            >>
            >> 'System.Threadi ng.Thread.Sleep (5000)'.[/color]
            >
            > I think it's in milliseconds so 5 minutes would be
            > 'System.Threadi ng.Thread.Sleep (300000)' 'three hundred thousand ms.[/color]

            Ooops. I mixed up 5 minutes with 5 seconds...

            --
            M S Herfried K. Wagner
            M V P <URL:http://dotnet.mvps.org/>
            V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

            Comment

            • Ricky W. Hunt

              #7
              Re: How can I make my VB .Net program sleep for 5 minutes?

              "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
              news:ewzPieBkEH A.2340@TK2MSFTN GP11.phx.gbl...[color=blue]
              > * "Ricky W. Hunt" <rhunt22@hotmai l.com> scripsit:[color=green][color=darkred]
              > >>> How can I make my VB .net program sleep or pause for say 5 minutes?
              > >>
              > >> 'System.Threadi ng.Thread.Sleep (5000)'.[/color]
              > >
              > > I think it's in milliseconds so 5 minutes would be
              > > 'System.Threadi ng.Thread.Sleep (300000)' 'three hundred thousand ms.[/color]
              >
              > Ooops. I mixed up 5 minutes with 5 seconds...[/color]

              Herfried, what does a program actually "do" during this sleep time? Is it
              consuming any resources other than memory?


              Comment

              • _IS_ -

                #8
                Re: How can I make my VB .Net program sleep for 5 minutes?

                I wrote this, maybe make 50 more... like 100 or so

                Sub Pause(ByVal pmTimeToPause As Double)

                Dim iIndex As Int16
                For iIndex = 1 To pmTimeToPause / 50
                If g_bEnd = True Then Exit Sub

                System.Threadin g.Thread.Curren tThread.Sleep(5 0)
                Application.DoE vents()

                Next

                End Sub

                1§ 1§

                *** Sent via Developersdex http://www.developersdex.com ***
                Don't just participate in USENET...get rewarded for it!

                Comment

                • Herfried K. Wagner [MVP]

                  #9
                  Re: How can I make my VB .Net program sleep for 5 minutes?

                  * "Ricky W. Hunt" <rhunt22@hotmai l.com> scripsit:[color=blue][color=green][color=darkred]
                  >>>>> How can I make my VB .net program sleep or pause for say 5 minutes?
                  >>>>
                  >>>> 'System.Threadi ng.Thread.Sleep (5000)'.
                  >>>
                  >>> I think it's in milliseconds so 5 minutes would be
                  >>> 'System.Threadi ng.Thread.Sleep (300000)' 'three hundred thousand ms.[/color]
                  >>
                  >> Ooops. I mixed up 5 minutes with 5 seconds...[/color]
                  >
                  > Herfried, what does a program actually "do" during this sleep time? Is it
                  > consuming any resources other than memory?[/color]

                  It still uses its resources, but it doesn't get any processor time. So
                  the UI will be "locked" in this time.

                  --
                  M S Herfried K. Wagner
                  M V P <URL:http://dotnet.mvps.org/>
                  V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

                  Comment

                  Working...