I have the same problem every time I re-pot or newly plant something. I read that the bugs come in the soil, I've had them in every brand I've used. I read that a simple solution is to put sand on top of your soil. The idea is that it doesn't kill the bugs right away, it just keeps them from flying out of the soil and laying their eggs. I tried it and it really works. I haven't seen a gnat since I used the sand. It's inexpensive, easy and natural.
What an awesome idea!!!! I am going to try that tonight! I have some of those little buggers in my office plants now