How to stop second program? RRS feed

  • Question

  • Hi Expert,

          I worte window service program with VB.Net. My program has two part. One is service program ( and another is simple program (vb). My problem is second program is stay running when i put "End" function. So How to close that program. What wrong in my code? Second Program is never close.

    Protected Overrides Sub OnStart(ByVal args() As String)
            ' Add code here to start your service. This method sarrhould set things
            ' in motion so your service can do its work.
            Dim clsEventLog As New EventLogs
            clsEventLog.CreatEvent("Import", "Import Service")
            clsEventLog.WriteEventLog("Import Service", "Service is started at " & Now.ToString, EventLogEntryType.Information)
            clsEventLog = Nothing
            Call ReadSettings()
            tTimer = New Timers.Timer(InterVal)
            AddHandler tTimer.Elapsed, AddressOf TimerFired
            With tTimer
                .AutoReset = True
                .Enabled = True
            End With
        End Sub
    Private Sub TimerFired(ByVal sender As Object, ByVal e As Timers.ElapsedEventArgs)
    End Sub
    Private Sub RunTask()
            Dim clsEventLog As New EventLogs
            Dim psInfo As New ProcessStartInfo
            Dim psProcesss As Process
            If gchkTemplateOrder Then
                psInfo.WindowStyle = ProcessWindowStyle.Normal
                psInfo.FileName = "c:\project1.exe"
                psInfo.Arguments = "-hi"
                psInfo.UseShellExecute = True
                psProcesss = Process.Start(psInfo)
                If Process.HasExited Then
                End If
    End Sub
    Form Load Event
            -- Write to file
    End Sub

    Tuesday, June 9, 2009 6:25 AM