Visual Basic句柄十进制逗号 [英] Visual basic handle decimal comma
问题描述
我正在尝试将变量保存到文本文件中,而捷克的印刷规则使我发疯。
我正在调试的程序专用于在使用十进制逗号但VB使用正常的标准十进制点的捷克本地计算机上工作。
I'm trying to save variables into text files and the Czech typographic rules drives me crazy. The program I'm tuning is dedicated to work on Czech localized computers where decimal comma is used but the VB is working with normal, standard decimal dot.
加载文件时, US小数将正确加载并显示为捷克小数。在TextBoxes中, Czech必须为小数。我的问题是程序生成捷克小数并需要美国小数。
When loading files "US" decimals are loaded correctly and showed as Czech decimals. In TextBoxes "Czech" decimals are required. My problem is that program generates Czech decimals and require the "US" ones.
如何强制VB程序将逗号读为小数而不是定界符或如何导出
How can I force VB program to read comma as decimal sign instead of delimiter or how to export data with dots instead of commas?
是的,我可以加载 123,456
作为 a = 123
和 b = 456
,然后将值返回为 a + b / 1000
,但在那里
Yes I can load 123,456
as a=123
and b=456
and then return value as a + b/1000
but is there more elegant solution?
推荐答案
您的麻烦可能是由于使用 Val
功能;那不是国际性的。帮助文本建议从字符串转换为数字时使用 CDbl
。
Your trouble might be due to use of the Val
function; that isn't international. The help text recommends the use of CDbl
when converting from strings to numbers.
这篇关于Visual Basic句柄十进制逗号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!