我要把textbox里输入的值存入数据库,可是没法转成double类型
double a=Convert.ToDouble(TextBox1.Text);
double a = double.Parse(TextBox1.Text);
这两种办法都是过了  都不行

解决方案 »

  1.   

    Double.Parse 方法 (String)  将数字的字符串表示形式转换为它的等效双精度浮点数字string s=   "100"    ;double i=double(s)
      

  2.   

    现在是要由人从textbox中输入  不能指定数值  上面2行代码是没通过编译的 求高手指点
      

  3.   

    double a=Convert.ToDouble(TextBox1.Text);这肯定是行的。楼主,说的不太清,发生什么错误。应该是其他地方有错误。
      

  4.   

    对textbox加validated事件,在事件中处理,在textbox的属性中找,或者在form的构造函数中增加
      textBox2.Validated += new EventHandler(textBox2_Validated);
                   
            }        void textBox2_Validated(object sender, EventArgs e)
            {
                throw new Exception("The method or operation is not implemented.");
            }