VB2010中的类型转换问题 [英] Problem with type conversion in VB2010

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

问题描述

我最近买了一台运行Windows 8的新笔记本电脑。我已经安装了Visual Studio 2012.我不应该遇到类型转换错误。任何人都可以告诉我这是否是Visual Studio的安装错误?





I have recently bought a new laptop running windows 8. I have installed Visual Studio 2012. I am getting type conversion errors when I should not. Can anyone tell me if this is an installation error for Visual Studio ?


Public Class Form1

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Dim n As Double = Convert.ToDouble("256.234")
        Debug.Print(n)
    End Sub
End Class





当我运行代码时ve,我收到以下错误。



FormatException未处理 - 输入字符串的格式不正确。



这没有任何意义..



When I run the code above, I get the following error.

"FormatException was unhandled - input string was not in a correct format."

This makes no sense..

推荐答案

你好,



Convert.ToDouble (字符串)解释该值正在使用当前线程文化的格式约定。请参阅 MSDN文档 [ ^ 。请检查您机器的区域设置并验证格式。



问候,
Hello,

The Convert.ToDouble(string) interprets the value is using formatting conventions of the current thread culture. Please see MSDN documentation[^]. Please check the regional Settings of your machine and verify the formatting.

Regards,


这篇关于VB2010中的类型转换问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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