formating numbers in databound textbox

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
 
C

Chris Jackson

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top