Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
I started off a .NET project by choosing it at the wizard as a Windows Application. However, I now think that I would like it to be a Windows Service. Is there any way I can convert it to a windows service?
Can you bind the beautiful Pleiades, and can you loose the cords of Orion? - God to Job...
Guest mutant
Posted

You could inherit your main class from ServiceBase, add OnStart method, and OnStop.

But it wont be that easy :), because i think youll have to change some otehr things too.

Posted
er........i don't really uinderstand wat u mean, i'm actually still a newbie, could you elaborate a bit more for me?
Can you bind the beautiful Pleiades, and can you loose the cords of Orion? - God to Job...
Guest mutant
Posted

Im assuming you have a form class.

Go to the top of it, you should see this:

Inherits Windows.Forms.Form

Change it to:

Inherits System.ServiceProcess.ServiceBase

This will make it a service.

Now, you need to override the OnStart and OnStop.

Protected Overrides Sub OnStart(ByVal args() As String)
      'in here you put the code that tells the service what to do
End Sub

Protected Overrides Sub OnStop()
      'tells the service what to do when it stops
End Sub

From there you just call your methods, functions, or whatever you call :)

Posted
i get an error message stating "Type System.ServiceProcess.ServiceBase" not defined, wat does this mean?
Can you bind the beautiful Pleiades, and can you loose the cords of Orion? - God to Job...
Posted
okok, sorry, i had to add the service process reference...
Can you bind the beautiful Pleiades, and can you loose the cords of Orion? - God to Job...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...