<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 窗体应用程序中验证文本框

        validating textbox in windows form applications(在 Windows 窗体应用程序中验证文本框)
          <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 窗体应用程序中验证文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to keep the Text of a Read only TextBox after PostBack()?(PostBack()之后如何保留只读文本框的文本?)
                  Winforms Textbox - Using Ctrl-Backspace to Delete Whole Word(Winforms 文本框 - 使用 Ctrl-Backspace 删除整个单词)
                  C# - Add button click events using code(C# - 使用代码添加按钮单击事件)
                  Multi-color TextBox C#(多色文本框 C#)
                  How can i set the caret position to a specific index in passwordbox in WPF(如何将插入符号位置设置为 WPF 密码框中的特定索引)
                  C# Numeric Only TextBox Control(C# 纯数字文本框控件)
                    <legend id='JEwRn'><style id='JEwRn'><dir id='JEwRn'><q id='JEwRn'></q></dir></style></legend>

                      • <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>
                            <tbody id='JEwRn'></tbody>
                          1. <small id='JEwRn'></small><noframes id='JEwRn'>