Adding a timer to the code

I have the following code below which is part of the code I am using which interprets an image field in a database which contains binary data and outputs it in a folder on a directory in rtf format.

The folder can contain up to 10 to 30 different documents a day.

The code below opens up the documents in word and prints them out

object oMissing = System.Reflection.Missing.Value;
object oFalse = false;
object oTrue = true;
                   
//create word
Word._Application oWord;
Word._Document oDoc;
oWord = new Word.Application();
oWord.Visible = true;
oWord.ActivePrinter = @"\\printer name";

//document
object file = Filename;
oDoc = oWord.Documents.Add(ref file, ref oMissing, ref oMissing, ref oMissing);

//print it
object xcopies = 1;
oDoc.PrintOut(ref oFalse, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref xcopies, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing);
oWord.Quit(ref oFalse, ref oMissing, ref oMissing);

I want to add a timer to this, but I am not sure how to do it and whereabouts in the code it should be placed. The timer should work as follows, one docmunets is printed out and instead of instantly opening up and printing the next document add a 30 second delay before printing and do this for every document contained in the folder.

Can anybody help

Poly
polynominalAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AlexFMCommented:
Thread.CurrentThread.Sleep(30000);

This line delays current thread for 30 seconds.
0
polynominalAuthor Commented:
Thanks I get the error message Type or namespace thread could not be found
0
RoninTheCommented:
Add - using System.Threading - on the top.
Whenever you get this "Type or namespace thread could not be found" error, search for the class name in msdn and see what namespace is required for that class.
e.g.
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemthreadingthreadclasstopic.asp
here you can see System.Threading is required for Thread class.
0
polynominalAuthor Commented:
Thanks for the answers. unfortunately msdn library is blocked at work so I cant see it
0
AlexFMCommented:
System.Threading.Thread.CurrentThread.Sleep(30000);
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.