Set Focus. How

Yea, i’ve never tried this before.
Whats the code to set focus to an object, and how do you use it. The method i was trying wasnt working and i dont think it was the right thing anyway.