In this Letter, the problem of a spinless particle under the moving boundary condition is studied. It is found that the exact solution can be found if the boundary moves with the constant speed. It is proven that this restriction on the exact solvability is lifted if the electromagnetic field is introduced in the system. As an application, the exact solution for the particle confined in the sinusoidally vibrating cylindrical well is given. (C) 2004 Elsevier B.V. All rights reserved.