Need C# code snippet for dynamic options...
kraxmo
Posts: 3
I am trying to query the Options enumeration using C# to populate a checklistbox with type Options, read the user-checked listbox rows and apply them to the comparison engine. Previously, I did the following:
Load: (object cb is a checklistbox object)
foreach (Option o in Enum.GetValues(typeof(Options)))
{
cb.Items.Add(o, false);
}
Read checked options:
public Options GetOptionsCheckListBoxCheckedItems(CheckedListBox cb)
{
Options tally = Options.None;
foreach (Options o in cb.CheckedItems)
{
tally |= o;
}
return tally;
}
I understand that the Option object referencing has changed from bit to method-based. I am currently trying to load the Options enum into the checkbox and return an array of type Options to include in the method call, but I am not having much luck. Any suggestions?
Load: (object cb is a checklistbox object)
foreach (Option o in Enum.GetValues(typeof(Options)))
{
cb.Items.Add(o, false);
}
Read checked options:
public Options GetOptionsCheckListBoxCheckedItems(CheckedListBox cb)
{
Options tally = Options.None;
foreach (Options o in cb.CheckedItems)
{
tally |= o;
}
return tally;
}
I understand that the Option object referencing has changed from bit to method-based. I am currently trying to load the Options enum into the checkbox and return an array of type Options to include in the method call, but I am not having much luck. Any suggestions?
Comments
http://documentation.red-gate.com/displ ... n+SDK+10.5
(see Use the new Options class)
let me know if you have any further questions on this.