I'm assuming you mean in PokéMon D/P.
Well. First of all, make sure you're connected to the WFC. Then, In order to find out what your friend code is, you must first obtain the Pal Pad key item (if you haven't already) You get this by heading into the underground floor of just about every PokéMon center.
Use it.
Scroll down to the third option (Trainername'S CODE) and select it. If everything goes right, It should display your friend code, and you can start using it for Wi-Fi purposes.