Reputation: 1133
I have a windows form with a text box: txtMyText.
txtMyText.Text is Bound to a data source: long lMyLongValue.
On the form I would like the value to display as a six digit value with leading zeros. Example 000123.
How can this be accomplished?
Upvotes: 1
Views: 2972
Reputation: 62286
I believe Binding.Format event, can be pretty suitable for your needs, if not, you can bind it not to long
property, but to string
property and handle conversion from long
-> srtring
and vice versa "by hand".
for convert it into formatted string use pretty simple example:
long l =13;
string sformat = l.ToString("000000"); // 000013
Regards.
Upvotes: 2