【问题标题】:Regional settings decimal separator not working in VB.net and ArcGis 10.1区域设置小数分隔符在 VB.net 和 ArcGis 10.1 中不起作用
【发布时间】:2013-07-11 19:26:35
【问题描述】:

我正在开发一个与 ArcGis ArcMap 10 和 10.1 一起使用的应用程序。我的应用程序是我添加到 Arcmap 的一个 dll(它是一个工具栏)。当我在我的机器上调试时,它工作正常(Windows server 2003 和 ArcGis 10)。但是在另一台机器上,即带有 ArcGis 10.1 的 Windows server 2008 上,将双精度值转换为字符串时,小数分隔符变为逗号 (,) 而不是点 (.)。如果我使用 cstr(variable) 或 text = variable 或 text=variable.tostring 将 double 变量转换为字符串,我总是得到一个逗号而不是一个点。

两台机器上的区域设置都是正确的。我尝试使用以下代码设置区域性,但出现“实例是只读的”错误。但我在 ArcGis 10 机器上没有收到此错误。

My.Application.Culture.NumberFormat.NumberDecimalSeparator = "."
System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.CurrencySymbol = "."

奇怪的是,当我查看 ArcGis 10.1 中的数字时,分隔符就是重点。所以问题似乎出在我的应用程序 dll 中。

有人可以帮我吗?

【问题讨论】:

    标签: vb.net decimal arcgis separator


    【解决方案1】:

    试试下面的代码

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Application.CurrentCulture = New CultureInfo("EN-US")
    End Sub
    

    【讨论】:

    • 它正在工作!非常感谢!我不得不稍微更改代码,因为我没有所需的导入,所以我这样做了: System.Windows.Forms.Application.CurrentCulture = New System.Globalization.CultureInfo("EN-US")
    猜你喜欢
    • 2013-12-21
    • 1970-01-01
    • 2017-05-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多