title: can i have a return function in windows service?
body: <p>can i have a function in windows service and return the data to vb.net application?</p>
  
  <p><strong>here's my sample code in windows service:</strong></p>
  
  <pre><code> Protected Overrides Sub OnStart(ByVal args() As String)
          ' Add code here to start your service. This method should set things
          ' in motion so your service can do its work.
          EventLog1.WriteEntry("In OnStart")
      End Sub
  
      Protected Overrides Sub OnStop()
          ' Add code here to perform any tear-down necessary to stop your service.
          EventLog1.WriteEntry("In OnStop.")
      End Sub
      Protected Overrides Sub OnContinue()
          EventLog1.WriteEntry("In OnContinue.")
      End Sub
      Protected Overrides Sub OnCustomCommand(ByVal command As Integer)
          Dim mymsg As String
          Dim servicestorun As New System.ServiceProcess.ServiceBase
          If (command &lt; 128) Then
              MyBase.OnCustomCommand(command)
          Else
              Select Case command
                  Case 129
                      mymsg = "i want this msg to my vb.net application"
                  Case Else
              End Select
          End If
  
      End Sub
  </code></pre>
  
  <p><strong>Here's my code with  vb.net application:</strong></p>
  
  <pre><code>Dim myServiceController As New System.ServiceProcess.ServiceController("MyNewService")
  
          Dim status As String
          Try
              myServiceController.ExecuteCommand(129)
   ' i want to get the msg from my windows service "i want this msg to my vb.net application"
              status = "Custom Command Executed Successfully!"
          Catch ex As Exception
              status = "Failed To Execute Custom Command! " &amp; ex.Message
          End Try
  </code></pre>
  
  <p>Please need help.</p>