C#判断 textBox1是否包含 有 某些 字符串(例如: - )这个符号
private void button1_Click(object sender, EventArgs e)
{
string m = textBox1.Text;
string n = Regex.Match(m, "-").ToString();
if (n != "")
{
textBox1.BackColor = Color.Red;
button1.Enabled = false;
button1.Text = "库存不足";
//存在
}
else
{
//不存在
textBox1.BackColor = Color.Gray;
button1.Enabled = true;
}
}
}
}