namespace TempForm
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public bool isnum(string s)
{
for (int i = 0; i < s.Length; i++)
{
if (!char.IsNumber(s,i)&&!(s[1]=='.'))
{
return false;
}
}
return true;
}
private void button1_Click(object sender, EventArgs e)
{
if (!isnum(textBox1.Text) || textBox1.Text == ""||(!isnum(textBox2.Text))||textBox2.Text == ""||(!isnum(textBox3.Text)) || textBox3.Text == "")
{
MessageBox.Show("请输入数字");
return;
}
label1.Text =( Convert.ToDouble(textBox1.Text) * Convert.ToDouble(textBox2.Text) * Convert.ToDouble(textBox3.Text)).ToString();
}
}
}
[[it] 本帖最后由 blueskyss 于 2008-4-5 19:08 编辑 [/it]]