protected void Button1_Click(object sender, EventArgs e)
{
if (RadioButton1.Text =="")
Response.Write("初始值不能为空");
else
{
float rr;
if (RadioButton1.Checked==true)
rr = ((float.Parse(TextBox1.Text) - 32)*5/9);
TextBox2.Text = rr.ToString();
}
}
//TextBox2.Text = rr.ToString();这个句子不对那?错在那里呀
{
if (RadioButton1.Text =="")
Response.Write("初始值不能为空");
else
{
float rr;
if (RadioButton1.Checked==true)
rr = ((float.Parse(TextBox1.Text) - 32)*5/9);
TextBox2.Text = rr.ToString();
}
}
//TextBox2.Text = rr.ToString();这个句子不对那?错在那里呀
解决方案 »
- C# .net 控件设计时的属性
- 没有经验的实习生在软件公司做二次开发好吗?
- 水晶报表--求解多次分组后的数据操作和动态列组合问题
- C# winform 怎么实现listbox的两种功能呢,一是拖动功能,二是也可以实现双击触发另一个操作,我现在的问题是双击的时候是先触发拖动功能,双击操作不起作用,谁知道告诉本姑娘一下,急着用,谢谢!
- 高高高手请进?~~~~~~~
- 关于WinForm中的Datagrid的。
- 如何知道WEB SERVICE服务器已可以连接?
- 如何用C#操作注册表?
- 时间转换问题
- mvc action 与view 的关系
- C#中" 并非所有的代码路径都返回值"请问这是什么错误啊? 急求,请大虾帮不弟看看
- 在灵川遇见的一个棘手的经验型面试问题。【经验者入】
TextBox2.Text = rr.ToString();
加个{}
{
rr = ((float.Parse(TextBox1.Text) - 32)*5/9);
TextBox2.Text = rr.ToString();
}
if(this.radioButton1.Text==null)
{
MessageBox.Show("初始化失败");
}
else
{
float rr;
if(this.radioButton1.Checked==true)
{
rr=((float.Parse(this.textBox3.Text)-32)*5/9);
this.textBox4.Text =rr.ToString();
}
}
但是如果TextBox1的值不为数字的话,就会包错,所以最好加个判断