Right, no I understand what you are doing, but the way you are going about it is incorrect. If _selectedName has any text in it, it messes up the int::Parse. That's why I'm asking what is in _selectedName at line 8? If it's "23 BobJones" it's not going to work, you'll have to take the substring with just "23" in it for the number to be parsed properly. If the number is not parsed properly, all of your indexes in lines 14,17,etc. are invalid, unfortunately.
I'd prefer not to do that, let's keep it on the site. On line 9 of the last time you posted code, put in System::Diagnostics::Debug::WriteLine("****** "+_selectedName+" *******"); Run your program, now in the bottom window of the IDE (marked output) tell me what's in between the stars.
Yes, because if _selectedEmployeeID is a string with just a number, int::parse is not going to have any problem with it.
What do you mean "it doesn't work"? It wasn't meant to fix the problem, it's meant to indicate what is in that string at the time. It's important. It can't parse the string, you've got to figure out what is in there that is throwing int::parse off and fix it. Me logging into your system is not going to change that, plus the policy of the forum is "keep it on the site."
Then make an additional text box on your form (temporarily) to display that value. I'm really absolutely certain that's where the problem lies, but if you can't tell me what _selectedName is before those int::Parse calls, I'm not going to be able to help you. I'm not sure why you are fighting me on this, these debugging steps are a critical part of the process.
"23" -> okay, easy to get 23 out of this using parse
"23restofstring" -> can't get out what we need -> throws exception
"restofstring23" -> same deal, can't get what we need ->throws exception
If you string is either of the last two cases, parse is not going to work on it.
Until we confirm what is in the string, we can't go any further. Once we know, we can truncate it to get the number out of it and parse that. I refuse to play games, either you figure out how to get access to that value or I will not be able to help. Period.
Okay, thank you. So what you need to do is select the "1" rather than the "Matt Whitehead" because there's not way for the compiler to get an array index out of "Matt Whitehead." It seems like the other routine you posted is doing that very task, though.
int::Parse is trying to extract a numerical value from "Matt Whitehead" and failing.