The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

1. This will wake up the trolls, but as far as I'm concerned I would always place an if statment to check that array index 1 existed before I accessed it, and consider relying on Error Handling to catch this as pretty poor. My only exception would be if the variable myString was a const or damn close to that (If It comes from the user or a database or a config file, I would always check its bounds).

2. Saddly, point 1, doesn't explain your error though. I would have thought 30 seconds with a debugger on the offending line, would clear up your problem.

3. Which brings me on to point 3, programming without the debugger is like driving without your eyes open, yes of cource it can be done, but why the hell would you be doing it. If for example this is only happens on your production server, then re-install your dot net stuff on that computer - Or wipe the server and start again.

I got a lot of ifs on the 3 steps above, and in no way do I think they are relevent to you, but instead they maybe relevent to you. Take the advice of the bits you like, if any, ignore the rest.

My problem is that I'm very new to .NET and don't understand many of the concepts or even much of the syntax just yet, hence me asking for help for a seemingly trivial problem.

The values come from a database, so I'm happy that I don't have to check that it exists. I just can't get this simple thing to work, and wondered if anyone with experience could point out where I am going wrong.

I don't know how to use the debugger. In fact I know nothing about it at all, but I can try to find out about it. If it's really like driving with your eyes closed then it would be stupid to not use it (although I've built a whole dynamic site and CMS so far, and this has been my only major problem).

Thanks for your pointers, I guess I'll have to read up about the dubugger.

Debugging is always a good idea, you will see exactly what is happening. Could be a problem with your char encoding and the string might display as a # in the browser, but when you view the source its encoded into something like Part1&#37;23Part2 and therefor your code doesnt find the hash. check what part 1 is in the array and ull probably find the full string there.

PS. %23 is not the encoding for #, i just used it as and eg. Cnt remember now what the hex value is for #

If your using nested in the old-fashion programmers meaning, as having two arrays with the same name in scope, then yes you can do that, though you will get problems that you just experienced.

If as NightStalker-DNS, believes, you mean multi-dimensional array, which I do know some languages like javascript use the word nested to mean multi-dimensions. Then yes c# handles multi-dimensional arrays just fine.

If you come from the world of javascript, for example, then yes javascript uses some words that are incorrect in the context of c based languages including c#. 'Real' programmers don't consider javascript and the manuals associated to be using these terms correctly.