Home All Groups Group Topic Archive Search About

Schedule task in VB.NET

Author
11 Apr 2005 3:07 PM
krallabandi
Hi,

I have a console application written in VB.NET. I schedule the job
using windows 2000 scheduler. It is all working fine but, its opening a
console when it was running. How to disable the console?

any clues?

Thanks.

Author
13 Apr 2005 11:25 AM
Crouchie1998
This is what you can do to get around your problem:

1) Open VS.NET & choose BLANK SOLUTION
2) Add a module to the project
3) Add references to SYSTEM & SYSTEM.WINDOWS.FORMS.DLL
4) Paste in the following code:

------------------------------------------------------------------------------------------------
Imports System

Imports System.Diagnostics

Imports System.Windows.Forms

Module Module1

    Sub main()

        Dim strStartupPath As String = Application.StartupPath

        Dim strFileToRun As String = IO.Path.Combine(strStartupPath, "TestApp.exe")

        Dim psi As New ProcessStartInfo(strFileToRun)

        psi.WindowStyle = ProcessWindowStyle.Hidden

        Process.Start(psi)

    End Sub

End Module

------------------------------------------------------------------------------------------------

Obviously, I have made it so that you put your console application that you want to run in the same directory as your BIN directory for this blank solution
Set your Task Scheduler to run the blank solution, which will run your application hidden.

I hope this helps

Crouchie1998
BA (HONS) MCP MCSE