Config Helper
SettingExists Method
Example 



KellermanSoftware.ConfigHelper Namespace > IniReaderWriter Class : SettingExists Method
The section name. Use GLOBAL for the global section.
The setting name
The path to the INI File
Return true if a setting exists
No COM Interop is used
If the file does not exist or the setting does not exist, the value returned will be false.
Syntax
Public Function SettingExists( _
   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.SettingExists(sectionName, settingName, filePath)
public bool SettingExists( 
   string sectionName,
   string settingName,
   string filePath
)
public:
bool SettingExists( 
   String^ sectionName,
   String^ settingName,
   String^ filePath
) 

Parameters

sectionName
The section name. Use GLOBAL for the global section.
settingName
The setting name
filePath
The path to the INI File
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");
 
bool results = iniReaderWriter.SettingExists("MySection", "MySettingName", "MySettingsFile.ini");
Console.WriteLine(results);
'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 results As Boolean = iniReaderWriter.SettingExists("MySection", "MySettingName", "MySettingsFile.ini")
Console.WriteLine(results)
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