Re: Regarding .config files
from my experience I'd discourage you from using .config files. I have always had problems with lost settings in a new app version etc. now I use the windows registry and all problems are gone. (I was to lazy to write my own config wrapper so using the registry was easier but the default .net .config files are evil)
Re: Regarding .config files
Well, maybe you´re right, but still, is there an answer to my questions?
Re: Regarding .config files
I think the best way is to catch the ConfigurationErrorsException like in msdn examples. some config wrapper could be very useful.
Re: Regarding .config files
You can check for nulls :
Code:
System::Configuration::Configuration ^config =
ConfigurationManager::OpenExeConfiguration(exePath);
if (config != nullptr)
{
AppSettingsSection ^appSettingsSection =
(AppSettingsSection^)config->GetSection("appSettings");
if (appSettingsSection != nullptr)
{
if (appSettingsSection->Settings["AddrColWidths"] != nullptr)
{
CommaDelimitedStringCollectionConverter^ converter =
gcnew CommaDelimitedStringCollectionConverter();
CommaDelimitedStringCollection^ collection =
(CommaDelimitedStringCollection^)converter->ConvertFrom(appSettingsSection->Settings["AddrColWidths"]->Value);
}
}
}
Darwen.