Hi all...
This function is called from the form_onload. I am basically reading the registry, determining which checkboxes are checkmarked, and then reflecting that in the GUI.
Is there any way to condense this and write better code? How about using CheckState property?
Thanks.
Woody
private void checkExcelSettings()
{
// Read what the values are for the checkboxes first and assign them to a string.
string _excelEnable = Convert.ToString(Registry.GetValue(@"HKEY_CURRENT_USER\Software\Mask Data\", "ExcelEnableHash", "Unchecked"));
string _excelSSN = Convert.ToString(Registry.GetValue(@"HKEY_CURRENT_USER\Software\Mask Data\", "ExcelSSNHash", "Unchecked"));
string _excelCC = Convert.ToString(Registry.GetValue(@"HKEY_CURRENT_USER\Software\Mask Data\", "ExcelCCHash", "Unchecked"));
string _excelWells = Convert.ToString(Registry.GetValue(@"HKEY_CURRENT_USER\Software\Mask Data\", "ExcelWellsHash", "Unchecked"));
string s=@"t\""; //unimportant no-op to placate stackoverflow syntax highlighter.
// Now let's make sure we reflect what they are supposed to be in the GUI.
if (_excelEnable == "Checked")
{
chkbxExcelEnable.Checked = true;
}
else
{
chkbxExcelEnable.Checked = false;
}
if (_excelSSN == "Checked")
{
chkbxExcelSSN.Checked = true;
}
else
{
chkbxExcelSSN.Checked = false;
}
if (_excelCC == "Checked")
{
chkbxExcelCC.Checked = true;
}
else
{
chkbxExcelCC.Checked = false;
}
if (_excelWells == "Checked")
{
chkbxExcelWellsFargo.Checked = true;
}
else
{
chkbxExcelWellsFargo.Checked = false;
}
}