<tfoot id='CStmy'></tfoot>

    <i id='CStmy'><tr id='CStmy'><dt id='CStmy'><q id='CStmy'><span id='CStmy'><b id='CStmy'><form id='CStmy'><ins id='CStmy'></ins><ul id='CStmy'></ul><sub id='CStmy'></sub></form><legend id='CStmy'></legend><bdo id='CStmy'><pre id='CStmy'><center id='CStmy'></center></pre></bdo></b><th id='CStmy'></th></span></q></dt></tr></i><div id='CStmy'><tfoot id='CStmy'></tfoot><dl id='CStmy'><fieldset id='CStmy'></fieldset></dl></div>
    • <bdo id='CStmy'></bdo><ul id='CStmy'></ul>

      1. <legend id='CStmy'><style id='CStmy'><dir id='CStmy'><q id='CStmy'></q></dir></style></legend>
      2. <small id='CStmy'></small><noframes id='CStmy'>

        在 Windows 窗体应用程序中验证文本框

        时间:2023-06-09
          <tbody id='uIIVl'></tbody>
        <i id='uIIVl'><tr id='uIIVl'><dt id='uIIVl'><q id='uIIVl'><span id='uIIVl'><b id='uIIVl'><form id='uIIVl'><ins id='uIIVl'></ins><ul id='uIIVl'></ul><sub id='uIIVl'></sub></form><legend id='uIIVl'></legend><bdo id='uIIVl'><pre id='uIIVl'><center id='uIIVl'></center></pre></bdo></b><th id='uIIVl'></th></span></q></dt></tr></i><div id='uIIVl'><tfoot id='uIIVl'></tfoot><dl id='uIIVl'><fieldset id='uIIVl'></fieldset></dl></div>

        <legend id='uIIVl'><style id='uIIVl'><dir id='uIIVl'><q id='uIIVl'></q></dir></style></legend>
        • <bdo id='uIIVl'></bdo><ul id='uIIVl'></ul>

              • <small id='uIIVl'></small><noframes id='uIIVl'>

                  <tfoot id='uIIVl'></tfoot>
                  本文介绍了在 Windows 窗体应用程序中验证文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我的情况是:

                  输入一个或多个字符后文本框的起始位置不允许有空格 文本框允许有空格

                  Not allowing spaces at starting position of textbox after enter one or more characters text box allows spaces

                  以下不适用于我的场景.

                  Below not applicable to my scenario.

                  private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
                  {
                      if (e.Handled = (e.KeyChar == (char)Keys.Space))
                      {
                          MessageBox.Show("Spaces are not allowed");
                      }
                  }
                  

                1. textBox1.Text.TrimStart()
                  

                2. 推荐答案

                  我相信lazyDBA的回答对你的要求是正确的,所以在消息框里面是这样的:

                  I believe that lazyDBA's answer is correct for your requirements, so with the message box something like:

                  if (textBox1.Text.Length == 0)
                  {
                     if (e.Handler = (e.KeyChar == (char)Keys.Space))
                     {
                         MessageBox.Show("space not allowed!");
                     }  
                  }`
                  

                  这篇关于在 Windows 窗体应用程序中验证文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:将 IHttpContextAccessor 注入 ApplicationDbContext ASP.NET Core 下一篇:WPF MVVM 负载上的焦点字段

                  相关文章

                  <legend id='JEwRn'><style id='JEwRn'><dir id='JEwRn'><q id='JEwRn'></q></dir></style></legend>

                  1. <i id='JEwRn'><tr id='JEwRn'><dt id='JEwRn'><q id='JEwRn'><span id='JEwRn'><b id='JEwRn'><form id='JEwRn'><ins id='JEwRn'></ins><ul id='JEwRn'></ul><sub id='JEwRn'></sub></form><legend id='JEwRn'></legend><bdo id='JEwRn'><pre id='JEwRn'><center id='JEwRn'></center></pre></bdo></b><th id='JEwRn'></th></span></q></dt></tr></i><div id='JEwRn'><tfoot id='JEwRn'></tfoot><dl id='JEwRn'><fieldset id='JEwRn'></fieldset></dl></div>
                    <tfoot id='JEwRn'></tfoot>
                      <bdo id='JEwRn'></bdo><ul id='JEwRn'></ul>
                    1. <small id='JEwRn'></small><noframes id='JEwRn'>