In this paper, we study the electronic structure of InAs/GaAs quantum rings and dots under applied magnetic fields. To compute electron-hole energy states and magnetization, a realistic three-dimensional (3D) model is applied and is solved with the nonlinear iterative method. With the developed nanostructure simulator, the variation of energy states for semiconductor quantum rings (Rin=10 nm) changing into dots (Rin=0 nm) are investigated comprehensively. For a fixed ring height and width, we have found the energy band gap of rings are strongly dependent on ring (and dot) shapes, ring inner radii, and applied magnetic fields. Due to the magnetic field penetration into the ring region, the variation of electron-hole energy states and magnetization of InAs/Gas rings saturate and oscillate nonperiodically when the magnetic field increases. Our observation in the oscillation of electron-hole energy states is contrary to conventional periodical argument. The results presented here provide an alternative in studying optical spectra and magneto-optical property of semiconductor quantum rings and are useful for real device applications.