When I was growing in soil, I had a lot of trouble with gnats. I saw a post on here, about using a layer of sand on top of the soil, and I tried it. It was 100% effective. Besides being easy, it was cheap, and used no pesticides. A $3 bag of sand covers a lot of pots.