This project has moved and is read-only. For the latest updates, please go here.

Get a list of tasks, descriptions and triggers into a datagrid

Topics: Setup
Jan 19, 2015 at 3:00 AM
Edited Jan 19, 2015 at 3:00 AM
Hi guys, I'm pretty new to coding and am trying to write a small app which shows a list of all the scheduled tasks on the local machine, along with the description and scheduled execution date/time. I'd like to have this info in a datagridview.

I've been trying to use the below code to get a list of the tasks, but I'm not sure what to do in the "do something here". What do I need to do now to get that info out?

I should mention I'm using VB.
Private Sub EnumAllTasks()
        Using ts As New TaskService()
        End Using
    End Sub

    Private Sub EnumFolderTasks(ByVal fld As TaskFolder)
        For Each task As Task In fld.Tasks

        Next task
        For Each sfld As TaskFolder In fld.SubFolders
        Next sfld
    End Sub

    Private Sub ActOnTask(ByVal t As Task)
        'do something here
    End Sub
Jan 26, 2015 at 4:41 PM
I think you may be able to use a ListView in Details mode with less overhead and then use the following code to pull the variables you need to load into that ListView.
Dim desc = t.RegistrationInfo.Description
Dim name = t.Name
Dim next = t.NextRunTime
Marked as answer by dahall on 1/26/2015 at 8:41 AM
Jan 27, 2015 at 8:12 PM
Thanks dahall, I got it working using those exact same variables.