Seedlings fail to grow well despite good light and water, and you can see fungus gnats in the room or greenhouse. If you examine the roots of a failed seedling, the roots will be skimpy and there may be tiny, translucent worms present. To investigate further, place a cut piece of potato on the soil's surface and check it after 4 hours. Some of the larvae present in the soil will have migrated to the rich new food supply.
Check houseplants regularly for infestations, and remove old leaves from the surface of potted plants. When growing seedlings indoors, allow the soil to dry between waterings if the plants can tolerate it. Cover moist, newly seeded containers with plastic to exclude interested gnats. Place yellow sticky traps, oriented horizontally, near seedlings to nab adults.
Several commercial products labeled for indoor use that are based on the Israelensis strain of Bacillus thuringiensis give good results when applied as a soil drench. Repeat after two weeks to control new fungus gnat larvae that may have hatched from eggs resting in the soil.