Yes, it must have to do with the allowed functions. If you choose an energy that is not an eigenvalue, you're wavefunction won't satisfy the boundary conditions--it'll blow up. Indeed, when you start doing problems, you'll see that the explicit calculation of the eigenvalues is done by...