I have have been using a technique for the last two years and it works. It's called sand. One 2 inch layer of play sand on top of your soil will not allow any bug to penetrate to the soil to lay their eggs. Yes there are wholes in the bottom of pots but bugs are stupid for the most part. A bag of sand is $3 and you can cover ten 3gal pots. Trust me on this. You will never have gnats again. I haven't. If you have an infestation, it will take about two weeks to kill them all. There is an art to pooring water onto sand without digging a hole in it. To start off, place a small bowl into your pot and poor the water into the bowl. It can be a hassle for those who don't have finesse or patience. But I love it, I don't have bugs. It's super cheap too. The picture here shows sand on top of the dirt and there is a little dirt on top but that doesn't hinder the sands effectiveness. I have no gnats.
View attachment 2162313