I'm very new to programming and i can't find a proper solution in C# for this:
I would like to cut a string (from PsList) to show it in a Listbox
I am running a CMD command and export it to a textfile - followed by the textfile being imported to a ListBox.
Currently my Listbox looks like this:
http://img856.imageshack.us/img856/700/pnr1.jpg
The problem is, that I just need the Name (or even better the PID(second collumn)) to kill the task with PsKill so I'd need to cut the String either at the first number until the next space, or if this isn't possible just the first part up to the first blank.
Also I'm not able to put the Textfile in a columned Listbox (due to missing seperators in the textfile, it's just a bunch of blanks seperating the columns) so I can't just access the correct column. Maybe it would be the easiest to put the textfile in a proper columned listbox but i'd need a hint there...
Thank you very much for any help!
Code for PsKillMethod currently is:
commandBuild("pslist", parameter: "> " + System.IO.Path.GetTempPath() + "pList.txt");
string[] pslistArray = System.IO.File.ReadAllLines(@System.IO.Path.GetTempPath() + "pList.txt");
ListBoxOutput pslistOutput = new ListBoxOutput(pslistArray);
pslistOutput.setLabel("Select the task to kill");
pslistOutput.setBtnVisible(true);
pslistOutput.Show();