Programming Tutorials

Using the ServiceBase Class in VB.net

By: Steven Holzner in VB.net Tutorials on 2010-10-23  

The ServiceBase class is the base class for a Windows service. Here is the inheritance hierarchy of this class:

Object
   MarshalByRefObject
      Component
         ServiceBase

You can find the more notable public properties of ServiceBase objects in Table below and their more notable protected methods in Table. (This class has no non-inherited events.)

Table: Noteworthy public properties of ServiceBase objects.

Property

Means

AutoLog

Specifies whether to record Start, Stop, Pause, and Continue commands in the event log.

CanPauseAndContinue

Gets/sets if you can pause and resume the service.

CanShutdown

Gets/sets if the service should be informed at system shutdown.

CanStop

Gets/sets if the service can be stopped.

EventLog

Gets an event log you can use to write to.

ServiceName

Gets/sets the name used to identify the service.

Table: Noteworthy protected methods of ServiceBase objects.

Method

Means

OnContinue

Executes when a service resumes after being paused.

OnPause

Executes when a service pauses.

OnPowerEvent

Executes when the computer's power status changes, as when notebooks go into suspended mode.

OnShutdown

Executes when the system is shutting down.

OnStart

Executes when the service starts.

OnStop

Executes when a service stops running.






Add Comment

* Required information
1000

Comments

No comments yet. Be the first!

Most Viewed Articles (in VB.net )

Latest Articles (in VB.net)