How do you get a friend code?

In whatever game you are playing, go into Nintendo Wi-Fi and then Friend Roster

how do u go to Nintendo wi-fi in poke mon diamond?