formating numbers in databound textbox

  • Thread starter Thread starter Derrick
  • Start date Start date
D

Derrick

I have the following:
collection of 'Cost' objects
a text box is bound to cost.maximumSalary - which is of type single.

When the text box displays the value of '20000000', it shows '2E+07'. Is
there a way to force a formated display in the text box while still using
data binding, or would I have to format the information in the
cost.maximumSalary Get?

Snipet of my code...
txtMaxSalary.DataBindings.Add("Text", myCollection, "MaximumSalary")


Thanks for any help

Derrick
 
If you create a handler for the TextBox's Format event, you can set the
Value property of the ConvertEventArgs argument to have the formatting that
you want. You can also create a handler for the Parse property if you need
to convert back when you are done.
 
Back
Top