Application.DoEvents in a service

  • Thread starter Thread starter Peter B Rasmussen
  • Start date Start date
P

Peter B Rasmussen

Please Help i am going mad :)

I am converting an application to a service using vb.net.

My problem is that i can't import the system.windows.forms.

What can i call instead?

In the code below ReturnValue is updated by a timer event.

Code:
Do

Application.DoEvents()

Loop Until (InStr(StrReturnValue, StrFindString) Or InStr(StrReturnValue,
"ERROR"))

Thanks in advance.



PBR
 
Peter B Rasmussen said:
Please Help i am going mad :)

I am converting an application to a service using vb.net.

My problem is that i can't import the system.windows.forms.

What can i call instead?

In the code below ReturnValue is updated by a timer event.

Code:
Do

Application.DoEvents()

Loop Until (InStr(StrReturnValue, StrFindString) Or
InStr(StrReturnValue, "ERROR"))

The "technical" explanation for not being able to Import the mentioned
namespace may be that you don't reference a/the library containing the
namespace. Apart from that, a service doesn't/mustn't need a UI so there's
no need for system.windows.forms and doevents. You may write a service _and_
a WinForms app and have them communicate with each other.
 
Thanks for the answer.

But i need a way to pause the process but still have the service application
running timers and stuff. Thats is my problem.

The program does not need an application frontend.

Thanks in advance

/Peter
 
You need multithreading!

Thread.Sleep() on the thread you want to pause

Multithreading is a pretty complicated thing. Do some reading on
multithreading and that should point you in the right direction.

Michael
 
Back
Top