Config Helper
DeleteSetting Method
Example 



KellermanSoftware.ConfigHelper Namespace > IniReaderWriter Class : DeleteSetting Method
The name of the section. Use GLOBAL for the global section.
The name of the setting
The path to the INI file
Delete a setting from an INI file
No COM Interop is used
If the file does not exist or the value does not exist, false will be returned.
Syntax
Public Function DeleteSetting( _
   ByVal sectionName As String, _
   ByVal settingName As String, _
   ByVal filePath As String _
) As Boolean
Dim instance As IniReaderWriter
Dim sectionName As String
Dim settingName As String
Dim filePath As String
Dim value As Boolean
 
value = instance.DeleteSetting(sectionName, settingName, filePath)
public bool DeleteSetting( 
   string sectionName,
   string settingName,
   string filePath
)
public:
bool DeleteSetting( 
   String^ sectionName,
   String^ settingName,
   String^ filePath
) 

Parameters

sectionName
The name of the section. Use GLOBAL for the global section.
settingName
The name of the setting
filePath
The path to the INI file

Return Value

True if the setting was deleted
Exceptions
ExceptionDescription
Occurs when sectionName, settingName or filePath is null
Example
//Trial Mode
IniReaderWriter iniReaderWriter = new IniReaderWriter();
 
//License Mode
//IniReaderWriter iniReaderWriter = new IniReaderWriter("place user name here", "place license key here");
 
iniReaderWriter.SaveSetting("MySection", "MySettingName", "MySettingValue", "MySettingsFile.ini");
 
string valueResults = iniReaderWriter.GetSetting("MySection", "MySettingName", "MySettingsFile.ini");
Console.WriteLine(valueResults);
 
bool deleteResults = iniReaderWriter.DeleteSetting("MySection", "MySettingName", "MySettingsFile.ini");
Console.WriteLine(deleteResults);
 
bool existsResults = iniReaderWriter.SettingExists("MySection", "MySettingName", "MySettingsFile.ini");
Console.WriteLine(existsResults);
'Trial Mode
Dim iniReaderWriter As New IniReaderWriter()
 
'License Mode
'Dim iniReaderWriter As New IniReaderWriter("place user name here", "place license key here")
 
iniReaderWriter.SaveSetting("MySection", "MySettingName", "MySettingValue", "MySettingsFile.ini")
 
Dim valueResults As String = iniReaderWriter.GetSetting("MySection", "MySettingName", "MySettingsFile.ini")
Console.WriteLine(valueResults)
 
Dim deleteResults As Boolean = iniReaderWriter.DeleteSetting("MySection", "MySettingName", "MySettingsFile.ini")
Console.WriteLine(deleteResults)
 
Dim existsResults As Boolean = iniReaderWriter.SettingExists("MySection", "MySettingName", "MySettingsFile.ini")
Console.WriteLine(existsResults)
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

IniReaderWriter Class
IniReaderWriter Members