这个行不通可以换另一种转换方式。例如:Convert.ToInt32("2")

解决方案 »

  1.   

    你把此行上几行的代码发上来看看,也许不是错在这行。
    或者试试直接
    int yy = int.Parse("2");
      

  2.   

    int yy  =Int32.Parse ("2"); 
    这肯定是对的!!
    如果楼主不对,哪就是灵异事件!
      

  3.   

    以前好像是可以的,但好像装了.net 3.0(已卸掉)后出现的,非常奇怪,在按钮事件里就这一行代码,把("2")改成("3")或其他数字,皆不正确,我从事.net编程7、8年了,第一次遇到。  
      

  4.   

    问题出在mscorlib.dll的
    private static unsafe bool ParseNumber(ref char* str, NumberStyles options, ref NumberBuffer number, NumberFormatInfo numfmt, bool parseDecimal)
    但.net 2.0我重新装过,还未解决问题。
      

  5.   

    int yy  =Int32.Parse ("2"); 
    肯定对的  你的环境应该有问题
      

  6.   

     
    这样对了,可能是我的.net语言包问题,但除2以外,其它表示都正常,奇怪呀?
    System.Globalization.CultureInfo Info = new System.Globalization.CultureInfo("en-us");
     int yy = Int32.Parse("2", System.Globalization.NumberStyles.Number, Info.NumberFormat);