Method and apparatus are described for treating and controlling diabetes and other systemic pancreatic endocrine disorders attributable to abnormal levels of secretion of endogenous insulin. An electrical stimulator implanted into or worn external to the patient's body is adapted, when activated, to generate a programmable electrical waveform for application to electrodes implanted on the vagus nerve of the patient. The electrical waveform is programmed using parameter values selected to stimulate or inhibit the vagus nerve to modulate the electrical activity thereof to increase or decrease secretion of natural insulin by the patient's pancreas. The stimulator is selectively activated manually by the patient in response to direct measurement of blood glucose or symptoms, or is activated automatically by programming the activation to occur at predetermined times and for predetermined intervals during the circadian cycle of the patient. Alternatively, the automatic activation is achieved using an implanted sensor to detect the blood glucose concentration, and is triggered when the patient's blood glucose concentration exceeds or falls below a predetermined level depending on whether diabetes or hypoglycemia is being treated.