Don't allow a specific use of characters

后端 未结 1 1337
夕颜
夕颜 2021-01-29 16:04

I bumped into a problem, i hope someone can help me out :)
I got a TextBox, and i want to limit users, so that they can\'t write multiple \\ one after another.<

1条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-29 16:50

    If the textbox contains \\, it is invalid:

    if (textBox1.Text.Contains(@"\\"))
    {
         MessageBox.Show("Error!");
    }
    

    0 讨论(0)
提交回复
热议问题