Larvae of Drosophila melanogaster are polymorphic with respect to their foraging behavior. ''Rovers'' move around, while ''sitters'' stay more in one place. This difference in movements while foraging may result in differences in the rate at which these larvae are attacked by hymenopteran parasitoids, especially by those that locate their hosts by reacting to the vibrations they make. From previous work it is known that D. melanogaster larvae show intra- and inter-population variation in their ability to destroy parasitoid eggs by encapsulation. If revers have a higher probability to be attacked by a parasitoid, they may have a higher developed encapsulation system as compensation for this higher attack probability. Experiments show that revers are indeed more often attacked by Asobara tabida, a vibrotactic (=reacting to vibrations) parasitoid, than sitters. However, foraging behavior and encapsulation ability appear to be independent of each other in D. melanogaster. This shows that the large variation between populations in encapsulation ability is not a reflection of the relative proportion of revers and sitters in the populations. It also shows that parasitoids can be an important factor in the maintenance of the foraging behavior polymorphism, because a higher encapsulation ability is not a compensation for a higher attack probability.