具有不变文化的双精度数据绑定列表

发布于 2024-09-15 16:45:41 字数 205 浏览 3 评论 0原文

我碰巧在类中有一个 double 列表,并将其数据绑定到组合框。 我遇到的问题是 double 显示的文本有逗号而不是点。例如 2,56 而不是 2.56

组合框似乎使用应用程序区域性将我的双精度数转换为字符串,

我不能只将应用程序区域性更改为不变。知道如何强制应用程序中的双打使用不变文化吗?

I happen to have a list of double in a class and databind it to a combobox.
The problem I am experiencing is that the displayed text for double has a comma instead of the dot. Ex 2,56 isntead of 2.56.

The combo box seems to convert my doubles to string using the application culture

I cannot just change the application culture to Invariant. Any idea how I can force doubles in my application to use the invariant culture?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

兔姬 2024-09-22 16:45:41

双打只是数字。他们没有文化。

另一方面,ComboBox 是可以的。您可以使用ComboBox.FormatInfo 属性来设置它。

doubles are just numbers. They do not have a culture.

ComboBoxes, on the other hand, do. You can set it using the ComboBox.FormatInfo property.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文