I'm just starting out with coding but I think I can help here. I use DBPro, so things may be different.
Use the command variable=sprite collision(boxsprite,charactersprite).
Your variable = 0 when the sprites aren't colliding, and the variable = 1 when they do collide. Then set up a logic loop to perform actions when the variable = 1.
sprite box,0,0,boximage
sprite char,0,0,charimage
P = sprite collision(box,char)
if P = 1 then insert actions here, separated by :
That just solves detecting the collision. You need to write a code so that when the collision happens, you can't move towards the box any more. For more information, look at Code Dragon's example in BiggAdd's link.
Read the tutorials. They will help you, even if the subject isn't what you are working on.