如何在仅限于数字的文本框中使用空格键?
private void CLimitTxt_KeyPress(object sender, KeyPressEventArgs e)
{
if (!char.IsNumber(e.KeyChar))
{
MessageBox.Show("You can only enter numbers within this textbox", "Error");
CLimitTxt.Text = "";
e.Handled = true;
}
}
我是否需要声明带有异常的var regex?
答案 0 :(得分:2)
就这么简单:
>>> "land" in "motherland"
True
>>> "banana" in "motherland"
False