sub pause

  • Thread starter Thread starter Paul Mars
  • Start date Start date
P

Paul Mars

How to pause in the middle of a sub?

I can not use a timer. The Sub can not be broken in two.

tx,
paul
 
Hi Paul,

What do you mean by 'pause'? Will there be a visual button to 'restart', is
the pause for a specified period of time, etc.

Bernie Yaeger
 
I can't figure this:

Original:

picMatch.Image = ImageListTraffic.Images(1)

MessageBox.Show("no match")

s.image = Nothing

picFirstPictureBox.Image = Nothing

The traffic image shows Red for No Match, but I needed a pause before
setting images to nothing. The MessageBox did that, but requires user click,
so:

picMatch.Image = ImageListTraffic.Images(1)

Threading.Thread.Sleep(2000)

s.image = Nothing

picFirstPictureBox.Image = Nothing

but this code does not set the traffic image until after the 2 seconds.
Why?? PS: There is something else that is in a code block above this block
that is also being delayed until after the sleep, so it is not just
everything inside this block. Block may be the wrong term, but hopefully u
understand.



P
 
Because in your code below you don't use the currentthread; where your sub
execute itself !

Bismark
 
* "Paul Mars said:
How to pause in the middle of a sub?

I can not use a timer. The Sub can not be broken in two.

For example, 'System.Threading.Thread.Sleep(1000)'.
 
Hi Herfried,

Did you read that from the answer by Paul which he told he had found it
himself
For example, 'System.Threading.Thread.Sleep(1000)'.
So you can also use this as

For example, 'System.Treading.Thread.Sleep(500)
or
For example, 'System.Treading.Thread.Sleep(4000)

I am glad that you understand this now too, however it is not needed to tell
that to the newsgroup.

:-)))

Cor
 
* "Cor Ligthert said:
Did you read that from the answer by Paul which he told he had found it
himself

Today in the morning I read it. When posting I was not really sure if
it will help and I didn't see Paul's "self-answer".
 
Today in the morning I read it. When posting I was not really sure if
it will help and I didn't see Paul's "self-answer".

I did wanted to add to the message from Rado, that a student from Wien deep
in the night had written it, however I stuffed it again.

:-))))

So now I write it.

Cor
 
I can't figure out from all this how to actually just simply pause any further execution but do all tasks before the pause as the System.Threading.Thread.CurrentThread.Sleep(1000) or System.Threading.Thread.Sleep(1000) halts execeution of some code lines before this statement.
 
Barry said:
I can't figure out from all this how to actually just simply pause
any further execution but do all tasks before the pause as the
System.Threading.Thread.CurrentThread.Sleep(1000) or
System.Threading.Thread.Sleep(1000) halts execeution of some code
lines before this statement.

I'm not sure if I understand. If you want to execute tasks before sleeping,
execute sleep after the tasks - or what do you mean?


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
Hi Paul,

The image is not showed for the end of the procedure, so probably never, try
to do a refresh before you let the thread sleep 2 minutes and refresh than
again.

I hope this helps?

Cor
 
Back
Top