Q:

Putting a process list into a combo box in C#

All I want, is that when I click on the comboBox1 box, that it will display all of the processes currently running.
private void comboBox1_MouseClick(object sender, MouseEventArgs e)
{
     comboBox1.Items.Clear();
     Process[] MyProcess = Process.GetProcesses();
     for (int i = 0; i < MyProcess.Length; i++)
            comboBox1.Items.Add(MyProcess[i].ProcessName + "-" + MyProcess[i].Id);
}

Why does it refuse to work? :s

A:

Try putting the code in the constructor right after the initializeComponets my guess is that you reset the combo box on each click as you reload the data then (including the click to select a value) and also your current code would not update the values if you use tab to focus the combobox!

