C# MaskedTextBox decimal currency not displaying correctly -


i struggling maskedtextbox. mask looks this: r ######.00 enter south african currency. still fine. save amount decimal field, , done correctly, decimal value , all. problem when try redisplay decimal field in maskedtextbox. way can display decimal value intact use:

edtbaycost.text = allparkingbayregistrationdata(currentdisplayrecord).baycost.tostring("000000.00"); 

in box displays eg. r 001234.56 have tried replacing tostring("000000.00") tostring("######.00") decimal value ignored , display r 123456.00.

am missing important here?

try using currency format specifier tostring() method:

edtbaycost.text = allparkingbayregistrationdata(currentdisplayrecord).baycost.tostring("c2"); 

https://msdn.microsoft.com/en-us/library/dwhawy9k(v=vs.110).aspx#cformatstring

edit:

you may use currency format specifier culture code. should give appropriate formatting currency attempting use:

edtbaycost.text = allparkingbayregistrationdata(currentdisplayrecord).baycost.tostring("c3",                cultureinfo.createspecificculture("en-za")); 

you can use table reference culture codes: https://msdn.microsoft.com/en-us/library/ee825488(v=cs.20).aspx


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -