Last active
July 6, 2021 10:38
-
-
Save Mahno74/71cd691e9382152fe9f7c229bbe9973d to your computer and use it in GitHub Desktop.
Загрузка и выгрузка состояний блока чекбоксов
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Cheked items to string: | |
string result = CheckedItemsToString(checkedListBox1.CheckedItems) | |
public static string CheckedItemsToString(CheckedListBox.CheckedItemCollection input) | |
{ | |
List<string> values = new List<string>(); | |
foreach (object o in input) | |
values.Add(o.ToString()); | |
return String.Join(",\n", values); | |
} | |
//Set data from string and check corresponding fields in CheckedListBox | |
for (int y = 0; y < checkedListBox1.Items.Count; y++) | |
if (result.Contains(checkedListBox1.Items[y].ToString())) | |
checkedListBox1.SetItemChecked(y, true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment