.代替 [英] . in place of ,

查看:87
本文介绍了.代替的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我有一个"detailview"与浮点数的数据.小数点分隔符有问题.我要使用."数字键盘的编号,但在比利时,分隔符为,".我想要那个."与,"相同.我该怎么办?

Hello,
I have a "detailview" with data in float number. I have a problem with the decimal separator. I want to use the "." of the numeric pad but in Belgium, the separator is ",". I want that the "." is the same as the ",". How can I do ?

推荐答案

您将需要使用带遮罩的文本框-支持文化的内容.
You will need to use a masked text box - something that supports cultures.


如果您的用户都在比利时,并且会假设,"是正确的分隔符,那么您应该能够将当前的文化设置为您所选择的比利时文化.

如果您实际上需要对多种文化的支持,则需要做更多的工作.您需要跟踪每个用户的首选区域性,然后在UI中显示值时使用该区域性.您还应该将信息存储在数据库中或采用不变文化的其他数据存储中.您可以在DetailsView上使用各种项目数据绑定事件来执行首选区域性<->.不变的区域性转换.
If your users are all in Belgium and would assume that "," is the correct separator, you should be able to just set the current culture to your Belgian culture of choice.

If you actually need support for multiple cultures you have a bit more work to do. You''ll need to keep track of each user''s preferred culture, then use that culture when displaying values in the UI. You should also store information in your database or other data store in the invariant culture. You can use the various item data binding events on the DetailsView to do the preferred culture <-> invariant culture conversions.


Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;


这篇关于.代替的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆