G
Graeme Anderson
I have written some code that loops through a windows panel that contains
many checkboxes. Depending on the flag, it should set the checkbox value to
true or false. The full framework has the HasChildren method, CF does not.
The code example below runs until I try and set the checkbox value then
bombs out. Any ideas appreciated.
Graeme Anderson
public static void ClearFormChecks (Control CallForm, bool CheckedValue )
{
// Iterate through each control on the panel passed in
foreach (Control ctl in CallForm.Controls )
{
// is the control a checkbox?
Type type = ctl.GetType();
if ((type.Name.ToString()) == "CheckBox" )
{
// change flag
Object t = type.GetType(); //<-- bombs here
CheckBox ChkTmp = (CheckBox)t;
ChkTmp.Checked = CheckedValue;
}
}
}
many checkboxes. Depending on the flag, it should set the checkbox value to
true or false. The full framework has the HasChildren method, CF does not.
The code example below runs until I try and set the checkbox value then
bombs out. Any ideas appreciated.
Graeme Anderson
public static void ClearFormChecks (Control CallForm, bool CheckedValue )
{
// Iterate through each control on the panel passed in
foreach (Control ctl in CallForm.Controls )
{
// is the control a checkbox?
Type type = ctl.GetType();
if ((type.Name.ToString()) == "CheckBox" )
{
// change flag
Object t = type.GetType(); //<-- bombs here
CheckBox ChkTmp = (CheckBox)t;
ChkTmp.Checked = CheckedValue;
}
}
}