C#判断字符串是否是数字
private void button7_Click(object sender, EventArgs e)
{
int n;
string str = textBox2 .Text ;
if (int.TryParse(str, out n))
{
MessageBox.Show("数字");
}
else
{
MessageBox.Show("不单单是数字");
}
}
{
int n;
string str = textBox2 .Text ;
if (int.TryParse(str, out n))
{
MessageBox.Show("数字");
}
else
{
MessageBox.Show("不单单是数字");
}
}