Re: Add form to a service
Quote:
Originally Posted by HWijngaarD
Does anyone know how to open a form in a window service?
You don't. Windows Services don't have UI's.
You can create a service control program that communicates with a service though.
Re: Add form to a service
Actually it can be done.
You must use threads and you must allow the service to interact with the desktop. Services run on a different background and thats why you get your error.
It's real pain thought. Do it only if you REALLY must use a form like that.
A different approach will be to have the service pass a value to a resident program (windows application) and from there you can stimulate it to show the form. It's a lot easier.
Re: Add form to a service
I've got an application that monitors files through an filesystemwatcher (how new is that).
When a new file has saved it picks it up and transfers it to the database.
(linq to sql is really handy)
I got one form on it where I save my settings to my.settings.
Including the server and the database location.
Whould you (sapator) help me doing this?
I allready set the service to interact with the desktop.
When I put the form.show in a thread I can't keep it open.
When the threads gone the forms gone...