title: Can a winform's MaskedTextBox allow spaces?
body: <p>I have a form that is dynamically created with a number of maskedtextboxes added to and their properties set (as in the code below).</p>
  
  <p>If 10 characters are required the code needs to validate if the entered text length is 10.  But the user is allowed to enter spaces at the beginning or end to make up those 10 characters.</p>
  
  <p>The maskedtextbox doesn't seem to keep those, or at least the way I have the properties set up it doesn't keep them (maybe b/c I have 'C' set?)</p>
  
  <p>I might just have something incorrectly set in the properties ... like with <code>AllowPromptAsInput</code> or <code>TextMaskFormat</code> or some other property, to allow this.</p>
  
  <p>Also I don't want to use a space as the 'PromptChar' since I want the user to see the number of chars to enter.</p>
  
  <pre><code>private void SetupMaskedTextBox(int allowedChars)
  {
      const char promptCharSquare = '\u25A1';
      maskedTextBox.PromptChar = promptCharSquare;
      string msk = null;
      for (int i = 0; i &lt; allowedChars; i++) {
          msk += "C";
      }
      maskedTextBox.Mask = msk;
      maskedTextBox.AllowPromptAsInput = true;
      maskedTextBox.TextMaskFormat = MaskFormat.IncludePromptAndLiterals;
  }
  </code></pre>