0
Sorry, I don't know if I'm misunderstanding the answer. But After I clear the Listbox, I fill it again calling EnumProc(), hence getting 50+ items in it when debugging. So how could SelectedIndex be -1 when the Listbox is filled?
0
Because you are clearing the list box before using "listBox_processes.SelectedIndex" you are getting -1.
You should do "Process ProcessCurrent = processes[listBox_processes.SelectedIndex];" before "listBox_processes.Item.Clear();" so that you can get the selected item properly.