views:

513

answers:

2
A: 

Turn on debug build and that will probably give you the possibility to add breakpoints and will also give you som row numbers at the stact trace.

Your problem is that you are not handling if p.Length = 0, that occurs if there is no process with the name "FirstLine".

Have you also renamed your process / application ?

bang
Not really got a .NET background so wasn't aware I could make the errors more descriptive! I'll try that now. Thank you very much!
Just reading up on processes under the .NET framework. I'll get back to you once I get my head around it. So far I've put an elseif p.length = 0 in and then I assume I just start a new process? I think that's right. Thanks very much for your help, it's deeply appreciated!
+4  A: 

Dim prc As Process = p(0) is your problem as it is in the else statements where the the array length can be anything but 1 (0 for instance).

when the length is 0 it will give you the IndexOutOfRange when you try to access the first element.

Pondidum
You're quite correct! I suppose my question would be why doesn't it react to breakpoints? It definitely executes that code (console.writeline yields output) but appears to ignore breakpoints entirely. Apologies if that's a stupid question =/