Vainly has 2 different meanings across 1 category:
Adverb
to no avail
"he looked for her in vain"
"the city fathers tried vainly to find a solution"
In a vain pursuit; to no avail.