Is it possible to Format the Text of a TextBox to display 3 digits even if the user has entered only a single digit?

e.g. the user entered "5", but I want to display it as "005".

I don't want to use MaskedTextBox.

In VB 6, it was as simple as
TextBox1.Text = Format(Val(TextBox1.Text),"000")

How can I get the same result in C# 2005??

Lalit Kumar Barik
India

I don't have VS to verify this, but i believe string.Format() does the trick:

textBox1.Text = string.Format("{0:00000}", someNumber);

Thank you again "sknake" for coming to my rescue.

Lalit Kumar Barik
India

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.