title: Secure data type to store password in a VBA.NET forms app in Systems.Setting
body: <p>Need to store the username and password for an outside application inside of a windows forms vb.net app. For initial testing, I just set the settings type to "Text", but want more security. </p>
  
  <p>There are System.Security and Encryption types available, but not sure where to begin. Any suggestions on how to Add, Update, and Delete the values is appreciated. Seems to be much more involved than the plain text.</p>
  
  <p>Although I want some level of security, this is not for any type of financial or medical application.</p>
  
  <p>EDIT: Code Error System.Configuration.Configuration Type is not defined.</p>
  
  <pre><code>Dim config As System.Configuration.Configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
  Dim configSection ConfigurationSection
  configSection = config.ConnectionStrings
  If Not (configSection Is Nothing) Then
      If Not (configSection.ElementInformation.IsLocked) Then
          configSection.SectionInformation.ProtectSection ("DataProtectionConfigurationProvider")
          configSection.SectionInformation.ForceSave = True
          config.Save(ConfigurationSaveMode.Full)
      End If
  End If
  </code></pre>