A heterostructure optoelectronic switch, grown by molecular beam epitaxy, has been fabricated. Owing to the carrier confinement and avalanche multiplication in the transport mechanism, S-shaped negative-differential-resistance performances are observed in the current-voltage (I-V) characteristics. The device shows a flexible optical function related to the potential barrier height and breakdown voltage controllable by incident light. The dependence of the I-V characteristics on illumination is attributed to the carrier confinement effect in the device operation. (C) 1998 American Institute of Physics.