' Modify a custom section. Show how to use the
' OpenExeConfiguration(ConfigurationUserLevel) method.
Shared Sub ModifyCustomSection()
' Get the application configuration file.
Dim config As System.Configuration.Configuration = _
ConfigurationManager.OpenExeConfiguration( _
ConfigurationUserLevel.None)
Console.WriteLine(config.FilePath)
Dim custSection As CustomSection = _
config.Sections(customSectionName)
custSection.FileName = "newName.txt"
custSection.MaxIdleTime = New TimeSpan(0, 15, 0)
custSection.MaxUsers = custSection.MaxUsers + 10
If Not custSection.ElementInformation.IsLocked Then
config.Save()
Else
Console.WriteLine("Section was locked, could not update.")
End If
End Sub 'ModifyCustomSection