All,
Does anyone know how to format the numbers displayed on a NumericUpDown control? I have two NumericUpDown controls on a form. One representing Hour and the other Minute. I want them to display a leading "0" if the hour or minute is < 10.
Display like "02" or "07".
Anyone???
TIA
Ken - KC7RAD
Formatting the display of a NumericUpDown control
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Mike GoldRank #50 · 30.6K reputationPosted Feb 21, 2007, 3:04 PM EST
(2) Choose add Custom Control
(3) Change the base class from Control to NumericUpDown
(4) override UpdateEditText with the following code:
protected override void UpdateEditText()
{
this.Text = Value.ToString("00");
// base.UpdateEditText();
}
(5) Compile
(6) Drag the new custom control from your toolbox to your form
-Mike G