With the game open go to Cheat --> cheat list... --> Add Gameshark...
now there is window that opens asking you for information on the gameshark code.
the site I placed above has many useful codes that you could use. However, lets consider the masterball code. You will not that there the site instructing you to replace the xx with the number, in that case the xx is replaced with 01. (easier to comprehend the instructions with the site open).
if you look at the codes above you will not for example:
"Slot 1 01xxB8D5 91xx93D8
Slot 2 01xxBAD5 91xx95D8"
what that means is that for slot 1 in your backpack (you will see item changes in your items slot of the backpack not the pokeball section), that is the first item that appears in the item section of your backpack if you place the code into gameshark then that item will change to a master ball.
You will also notice in the example above that there are to set of codes per slot. One of them should work for the gameshark in your PC. I found that 0101B8D5 did not work, however 910193D8 changed the item in my first slot (I had 4 ethers) into master balls (in this case 4 masterballs).
Hope you were able to follow the instructions.