首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

请问个小疑点。

2013-01-01 
请教个小问题。。。。。。这是我的后台代码,没有错的,能运行。[解决办法]放构造函数里protected void btc(){int n

请教个小问题。。。。。。
这是我的后台代码,没有错的,能运行。


[解决办法]
放构造函数里

protected void btc()         
{             
int normalTemperature = Convert.ToInt16(DropDownList1.SelectedItem.Text);             
int addTemperature = Convert.ToInt16(DropDownList2.SelectedItem.Text);             double materialValue = Convert.ToDouble(DropDownList3.SelectedItem.Value);             
int equipmentQuantity = Convert.ToInt16(TextBox2.Text);             
int normalMoisture = Convert.ToInt16(DropDownList5.SelectedItem.Text);             int addMoisture = Convert.ToInt16(DropDownList6.SelectedItem.Text);             


int targetMTBF = Convert.ToInt16(TextBox3.Text);               
double power1 = materialValue / normalTemperature - materialValue / addTemperature;             
double power2 = (normalMoisture * normalMoisture)/10000 - (addMoisture * addMoisture)/10000;             
double moutiplier = Math.Pow(2.18, power1);             
double montiplicand = Math.Pow(2.18,power2);             
double af = moutiplier * montiplicand;               
double t=targetMTBF/(equipmentQuantity*af);               
TextBox1.Text = t.ToString();         
}
 protected void Button2_Click(object sender, EventArgs e)         
{  
          btc(); 
 }


[解决办法]
在事件外面定义变量,在事件中赋值。

热点排行