title: Application Data Folder and Company Name With Underscores
body: <p>My VB.NET 2008, .NET 3.5 application is using an app.config with settings defined as User. As expected, it created the folder:</p>
  
  <pre><code>C:\Documents and Settings\&lt;user&gt;\Local Settings\Application Data\&lt;company name&gt;\
  </code></pre>
  
  <p>In this folder are the sub-folders for the application to store the user settings. However, the folder of the company name has underscores:</p>
  
  <pre><code>C:\Documents and Settings\&lt;user&gt;\Local Settings\Application Data\This__Is_My_Company\
  </code></pre>
  
  <p>None of the other folders in this directory have underscores, and it looks stupid. Is there any way to tell the application to create the folder without underscores in the name?</p>
  
  <p><strong>UPDATE (26-Mar-2012):</strong></p>
  
  <p>This appears to be more of an issue on Windows 7 (at least - could be XP too but I'm already off XP). If I use the .NET Framework to create the folder if it doesn't exist ...</p>
  
  <pre><code>Const TEST_FOLDER_PATH As String = "{0}\{1}"
  
  Dim appDataFolderPath As String = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
  Dim companyName As String = My.Application.Info.CompanyName
  
  MessageBox.Show(String.Format(TEST_FOLDER_PATH, appDataFolderPath, companyName))
  </code></pre>
  
  <p>... then it will produce a folder path <strong>without</strong> underscores in the company name. Oddly enough, .NET 3.5 still creates its own folder in \AppData\Local\ for the user's app.config settings <strong>with</strong> underscores.</p>
  
  <p>I end up with one folder with underscores for the user's app.config data, and one folder without underscores so I can tell our third-party spell checker where to store the user-dictionary.txt file. Looks like I'll have to hard-code the company name in order to keep everything to one folder, or live with two folders. Wonderful ...</p>