Refreshing listview automatically when a new process enters
<pre><code>public void processloader(object temp) 
{

    Process[] processes = null;
    try
    {
        processes = Process.GetProcesses();
    }

    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
        Application.Exit();
        return;
    }
    listView1.BeginUpdate();
    listView1.Clear();
    int threadscount = 0;
    listView1.Items.Clear();
    foreach (Process p in processes)
    {
        try
        {
            string[] prcdetails = new string[] { p.ProcessName, p.Id.ToString(), p.StartTime.ToShortTimeString(), p.PriorityClass.ToString(), (p.WorkingSet64 / 1048576).ToString() + "Mb", p.Threads.Count.ToString() };
            ListViewItem proc = new ListViewItem(prcdetails);
            listView1.Items.Add(proc);
            threadscount += p.Threads.Count;
        }
        catch { Console.WriteLine(p); }
    }
    statusBar1.Panels[0].Text = "Processes : " + processes.Length.ToString();
    statusBar1.Panels[1].Text = "Threads : " + (threadscount + 1).ToString();
    listView1.EndUpdate();
    listView1.Refresh();


}
</code></pre>

<p>here is the refreher block i call this function every second by using System.threading.timer(). i need a solution like original taskmanager refreshing functionality can anyone help for this? please provide some sample codes. thanks in advance!</p>
