In an image forming apparatus having a toner container, the remaining amount
of
toner is detected by measuring a capacitance caused by a toner detector member
in the toner container. It is determined whether the measured capacitance falls
within a predetermined range. If it is determined that the measured capacitance
falls not within the predetermined range, the measured capacitance is not used
in the detection of the remaining amount of toner. The present invention thus provides
an image forming apparatus reliable in the detection of toner, and a method of
controlling the apparatus.