delay

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

    #1

    delay

    hi, i have a program that will execute printing with delay. the last time i
    posted a question on how to introduced delay to my program, i believe i given
    an advice on using the following...

    Threading.Threa d.Sleep(11000)

    it work fine, but i do want to introduce a "cancel" function in my program
    so that my program can stop anytime i want, but with the above command, the
    program will hang for 11sec as shown and during this 11sec, no command can be
    entered...how can i solve this?
  • Cor Ligthert

    #2
    Re: delay

    Newbie,

    (When you use a normal name it is easier to react on previous messages from
    you).

    \\\
    for i as integer = 1 to 11
    threading.threa d.sleep(i * 1000)
    application.doe vents
    next
    ///

    I hope this helps,

    Cor


    Comment

    • Herfried K. Wagner [MVP]

      #3
      Re: delay

      "Cor Ligthert" <notmyfirstname @planet.nl> schrieb:[color=blue]
      > (When you use a normal name it is easier to react on previous messages
      > from you).
      >
      > \\\
      > for i as integer = 1 to 11
      > threading.threa d.sleep(i * 1000)
      > application.doe vents
      > next
      > ///[/color]

      \\\
      Private m_Cancel As Boolean
      ..
      ..
      ..
      Private Sub Button1_Click(. ..)...
      m_Cancel = True
      End Sub
      ..
      ..
      ..
      For i As Integer = 1 To 11
      Thread.Sleep(10 00)
      Application.DoE vents()
      If m_Cancel Then Exit For
      Next i
      ///

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

      Comment

      Working...