Mediocre advice: To keep a swarm in a box put them in with a screened bottom board, deep full of empty frames, and a big feed jar on top, screw the entrance shut. Don't give them an opening until they are taking sugar water, after that they will stay.
Actually they need to have taken enough sugar water to get the queen a place to lay, Late afternoon I opened the swarm hive 2 bees wide and the 6 lb swarm was gone by 11 the next morning.
Or going back to Charlie B's good advice: give them food and brood and leave them alone, they won't leave brood. That has always worked actually.