Advertisement
Guest User

Untitled

a guest
Sep 30th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. Dim config As Configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
  2.  
  3. Dim grp As ConfigurationSectionGroup = config.SectionGroups("userSettings")
  4. If grp Is Nothing Then
  5. Return
  6. End If
  7.  
  8. Dim section As ClientSettingsSection = grp.Sections(userSectionName)
  9.  
  10. Dim setting As SettingElement = New SettingElement(name, SettingsSerializeAs.String)
  11. Dim eltValue As SettingValueElement = New SettingValueElement()
  12.  
  13. Dim element As XmlElement = New XmlDocument().CreateElement("value")
  14. element.InnerText = value
  15. eltValue.ValueXml = element
  16. setting.Value = eltValue
  17.  
  18. section.Settings.Add(setting)
  19.  
  20. config.Save(ConfigurationSaveMode.Modified)
  21. 'config.Save(ConfigurationSaveMode.Full)
  22.  
  23. 'My.MySettings.Default.Save()
  24.  
  25. ConfigurationManager.RefreshSection("userSettings")
  26.  
  27. My.MySettings.Default.Reload()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement