How can I write a C# winforms code like this?
CheckedListBox items don't have 'Tag' and 'ValueMember' properties.
I know there are many alternatives to this. But I need to work it this way.
private void LoadPermissionsToCheckedListBox()
{
Role selectedRole = (Role)comboBox1.SelectedItem;
int i = 0;
foreach (Permission p in selectedRole.PermissionItems)
{
checkedListBox1.Items.Add(p);
checkedListBox1.Items[i].Tag = p;
}
checkedListBox1.DisplayMember = "PermissionKey";
checkedListBox1.ValueMember = "PermissionID";
}