Page 1 of 1

A Task Manager Tutorial

Posted: Sat Dec 04, 2010 11:05 pm
by dradra43
Level = ★☆☆☆☆

Hello, I hope all of you are having a good day. To begin I wanna say thanks, to everyone on the forum, for showing me how to code better! cooll;

Lets begin now, first create a new project, in this lets name it... Task Manager
On your form, you'll need
  • 1 list box
    2 buttons
Name button1: TaskRefresh

Name Button2: TaskKill

Keep listbox1 the same name.

Now, re-decorate your form, anchor stuff were you want it, do whatever.

Now it is time for coding!
Above the public class form1 code paste this:
Code: Select all
Imports System.IO
In the TaskRefresh_click code:
Code: Select all
GetProcesses()
TaskKill_Click code:
Code: Select all
KillProcess()
        GetProcesses()
You should have NOTHING but error's but thats ok
Time for the next code.

Above 'End CLass' paste this:
Code: Select all
    Public Sub GetProcesses()
        ListBox1.Items.Clear()

        Dim p As Process
        For Each p In Process.GetProcesses
            ListBox1.Items.Add(p.ProcessName)
        Next
    End Sub
    Public Sub KillProcess()
        Try
            Dim p As Process

            For Each p In Process.GetProcesses
                If p.ProcessName = ListBox1.SelectedItem Then
                    p.Kill()
                End If
            Next
            GetProcesses()
            MsgBox("You just killed your sected item", vbOKOnly, "Worked")
        Catch ex As Exception
            MsgBox("Failed to close due to administrator rights!")
        End Try
    End Sub
Thank you all, have good day/morning/night. Cya next time coder's!
Image

Re: A Task Manager Tutorial *ADVANCED*

Posted: Sat Dec 04, 2010 11:09 pm
by dradra43
It is easy to do, but the actual code is advancd...
Happy coding

Re: A Task Manager Tutorial *ADVANCED*

Posted: Sun Dec 05, 2010 12:17 am
by mandai
Advanced how?

Re: A Task Manager Tutorial *ADVANCED*

Posted: Sun Dec 05, 2010 12:31 am
by dradra43
mandai wrote:
Advanced how?
Its easy for YOU to do, it was advanced for the coding... I was gonna make everyone code it themselves, and thats why i put advanced. But it works just like default task manager. It kills items, and does everything the real one does.

Re: A Task Manager Tutorial

Posted: Tue Dec 07, 2010 4:33 pm
by Agust1337
Dradra43, Don't mind Mandai he comes up with these comments.

Re: A Task Manager Tutorial

Posted: Tue Dec 07, 2010 8:49 pm
by mandai
I think a better term may be do-it-yourself but I understand what he means now.

Re: A Task Manager Tutorial

Posted: Wed Dec 15, 2010 3:58 am
by VBCoder101
THANKS! This was my first program! It was very easy to understand! YOU ROCK!