【问题标题】:Visual Studio 2010 C# .NET textbox restrictionsVisual Studio 2010 C# .NET 文本框限制
【发布时间】:2011-02-17 01:19:06
【问题描述】:

如果用户输入“!” “?” “,”在文本框中并按下按钮,此人会在标签中看到错误消息。 怎么能做到呢?代码是什么?

【问题讨论】:

    标签: c# visual-studio-2010 textbox restriction


    【解决方案1】:

    在按钮点击处理程序中做:

    if (textbox.text.contains("!") || textbox.text.contains("?") || textbox.text.contains(",")){
         //display error message code
         label.text = "ERROR";
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-25
      • 2013-02-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多