title: Any Characters - Masked Text Box
body: <p>I'm writing an app in C# with Visual Studio 2012, and I'm needing to format some input text using MaskedTextBox. The user will type in a folder path to the text box, but since the folder path is relative to another path, I need it to start with ".\", but I do not care how long the path is. </p>
  
  <p>Right now, I have the mask set for the box to <code>\.\\CCCCCCCCCCCCCCCCCC</code>. This works fine except for the fact that when the user clicks into the box, it places the cursor where they click instead of the beginning of the box.</p>
  
  <p>Is there a way to set the mask to still put in the ".\" but not to set any limit on the characters that come after it?</p>
  
  <p>Or is there a way I'm overlooking?</p>
  
  <p>EDIT: More info</p>
  
  <p>So I've tried a couple recommended things, but they don't seem to work. The answer linked <a href="https://stackoverflow.com/questions/1435376/masked-textbox-input-align-left">here</a> doesn't work well. While I can set it to go to that selection point when I click on the box, it will go there every time you need to click on the box. So you can't select the whole box or edit part of what you typed, which is even worse for usability.</p>
  
  <p>I also tried the method suggested by Adelmo. I made an even handler like so:</p>
  
  <pre><code>public Form1()
  {
      InitializeComponent();
      refreshList();
      this.textBoxPrintFolder.GotFocus += new EventHandler(textBoxPrintFolder_GotFocus);
  
  }
  private void textBoxPrintFolder_GotFocus(object sender, EventArgs e)
  {
      this.textBoxPrintFolder.Select(2, 0);
  }
  </code></pre>
  
  <p>This works when tabbing to the box, but apparently clicking on the box doesn't go into the GotFocus event.</p>
  
  <p>I've also tried using the MouseEnter event. While it does work, it takes a few seconds before it will move. Not ideal. </p>
  
  <p>Any help would be greatly appreciated.</p>