After doing some searching on the site, I was able to get the following code to return the running processes on the computer.

Private Sub ProcessMonitor_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim Prc As Process()
        Dim x As Integer

        Prc = Process.GetProcesses

        For x = 0 To UBound(Prc)
            TreeView1.Nodes.Add(Prc(x).ProcessName)
        Next
    End Sub

I was wondering how I could make this resemble the Task Manger a little more with the sortable columns and the extra info that is shown in the Task Manager.

Recommended Answers

All 2 Replies

display all running programs ()
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'displays the current system processes.
        Dim myquery = From anitem In Process.GetProcesses _
                Select anitem.ProcessName, anitem.Threads.Count, anitem.Responding
        DataGridView1.DataSource = myquery.ToList
    End Sub

Use a ListView for Columns.

With ListView1.Columns '// add Columns.
            .Add("Process Name", 100) : .Add("User Name", 100) : .Add("CPU", 100) : .Add("Memory", 100) : .Add("Description", 100)
        End With
        ListView1.View = View.Details '// Display Columns.
        '// get Processes.
        Dim Prc As Process() = Process.GetProcesses
        For x As Integer = 0 To UBound(Prc)
            Dim newItem As New ListViewItem(Prc(x).ProcessName) '// Item.Text. for column 1.
            newItem.SubItems.Add("User Name") '// column 2.
            newItem.SubItems.Add("CPU") '// column 3.
            newItem.SubItems.Add("Memory") '// column 4.
            newItem.SubItems.Add("Description") '// column 5.
            ListView1.Items.Add(newItem) '// add item to ListView.
        Next
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.