可以用Convert方法实现
Convert.ToInt32("12345");
根据需要选用不同的精度。ToInt16/ToInt64 ....

解决方案 »

  1.   

    还有最好这样:
    try
    {
    Convert.ToInt32("12345");
    根据需要选用不同的精度。ToInt16/ToInt64 ....
    }
    catch(Exception exce)
    {
     MessageBox.Show(exce.Message);
    }
    否遇字符串不能成功转换为数字时那就麻烦了。
      

  2.   

    最好用方法
    System.Int32.Pause(String)
    就可以了
      

  3.   

    用double.TryParse(...)
    或double.Parse(...)
      

  4.   

    还有最好这样:
    try
    {
    Convert.ToInt32("12345");
    根据需要选用不同的精度。ToInt16/ToInt64 ....
    }
    catch(Exception exce)
    {
     MessageBox.Show(exce.Message);
    }
    否遇字符串不能成功转换为数字时那就麻烦了。
    强烈同意
      

  5.   

    给你个思路
    public static bool IsNumeric(object value) 

       try 
       {
              int i = Convert.ToInt32(value.ToString()); 
              return true; 
        } 
        catch //(FormatException) 
        { 
               return false; 
         }
    }
      

  6.   

    还有最好这样:
    try
    {
    Convert.ToInt32("12345");
    根据需要选用不同的精度。ToInt16/ToInt64 ....
    }
    catch(Exception exce)
    {
     MessageBox.Show(exce.Message);
    }
    否遇字符串不能成功转换为数字时那就麻烦了。
    心疤说的没错。我也强烈同意。