Hey i got a great question.
Ok, i was training a Yanmega, trying to get the two ivs i wanted for: Special Attack and Speed... Ok i got it. 30 for Sp. Attack and 31 for Speed. Ok, now i was trying to give it the 510 evs. 252 to each two stats. Ok i kiledl 25 Gastlys with Pokerus and Power Lens, Ok i leveled it up, and gained +43. Ok, after that i killed 25 magikarp with Power Anklet and Pokerus to give it Speed, but at level it up, it only gained +8. I was so angry so i turn off the DS, ok, after that i tried again, the same pokemon, the same place, the same pokemon defeated, but at this very time, it got worst, it only gained +5 at Speed (having 31 ivs at Speed). I saved it, because a friend is going to fix it

. Ok, now, that friend told me a couple of things. And then he told me, that my method to train was wrong, (my technique to level my pokemon is: In a fight put the pokemon i want to train first, after that, send another to fight in its place, and through that way, the pokemon will gain experience, but i was ignorant, that through that way, it wins evs too, i was shock, i did not know this, and maybe for that reason my Yanmega didnt work out).
After i explained him that how i gave evs to my pokemon, he told me, that he gives evs to is pokemon at Level 97 (around that level) and it evolves them, near that level, and that he trains his pokemon with Rare Candys, so through that way, they wont gain any evs. Its logical xD.
But Im asking, Do i have to train through that way? Im asking because he is very very good at the battles.
Or, How do i have to train to gain the evs and stats that i want?
Please answer me