Prime Number Finder

So I'm working on Project Euler question 7, find the 10 001st prime. I've tried to work out why my code is failing for a while now and I still can't get it. I thought that if I built an array of the primes I could just check any new number against all the elements in the array, and if it didn't divide nicely with any of them then that number would be prime.